Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 monitor folder

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2007-03-21 : 13:04:24
Hi,
There is a folder on the network (FolderMain) that gets populated with .xml files.
It is not known at what time of the day the folder gets populated with files. But it does happen every now and then. i.e. every few days or once a day, etc...
What is the best way in .net 2.0 or sql server 2005 to monitor if there are any files in that folder on the network. I am thinking of using FileSystemWatcher in .net 2.0
So that as soon as a file is added to the folder it can be processed.
Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-03-21 : 14:09:50
Why not just run your job/task every 4 hours or so? Just have it check for the existence of the files, then exit if there is nothing to process.

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-03-21 : 15:39:31
The FileSystemWatcher will do exactly that, it will have to be loaded all the time so the best is to create a Windows Service and use the FileSystemWatcher in the service, so that it is always running without someone having to be logged onto the computer.
Go to Top of Page

MohammedU
Posting Yak Master

145 Posts

Posted - 2007-03-22 : 01:52:44
You can do both ways...
In sql you have master..xp_fileexist procedure to check the file existence...
and can be scheduled to as a job and get the db mail notification if the file exists...


MohammedU
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2007-03-22 : 04:49:26
if I use xp_fileexists then how it is possible to read the data in the files please?
Go to Top of Page
   

- Advertisement -