0

I am coding in c# using filesystem watcher to check a directory. How can I say "after 8:00 am if file X is not existing do ....." ?, this have to be verified every day. Thanks for your help !

francops henri
  • 517
  • 3
  • 16
  • 28

2 Answers2

2

I don't think you need a FileSystemWatcher here. Simply use a Timer or Scheduled tasks which runs at 8:00, then check for your file exist and get the job done.

Timer can be used if your application will be running all the time throughout the day 24 x 7, otherise use latter.

FileSystemWatcher is something, that we use to get notifications about change in the file system anytime and not for checking something exist at particular time.

Update: You can use the FileSystemWatcher to get the file update immediately, then process it and also the Timer mentioned above which finds whether file hasn't been created till 8.00.

Community
  • 1
  • 1
Sriram Sakthivel
  • 69,953
  • 7
  • 104
  • 182
0

You can use a scheduler such as Quartz.Net to start at a certain time of the day, see the site for more details:

http://www.quartz-scheduler.net/

Ric
  • 12,371
  • 3
  • 26
  • 36