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 !
Asked
Active
Viewed 55 times
2 Answers
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
- 72,067
- 7
- 111
- 189
-
1Unless OP needs to process the file as soon as it arrives and take some action if the file doesn't arrive before specified deadline... – Grx70 Nov 13 '14 at 09:09
-
@Grx70 Anyway that's not mentioned in question. – Sriram Sakthivel Nov 13 '14 at 09:12
-
@Gr70 Yes that what I am doing. I need to send an email if the file doesn't arrive before a specified deadline. If the file is exist it will be processed , that is why i am using FileSystemWatcher. Sriram sry to not specify that – francops henri Nov 13 '14 at 09:14
-
@Grx70 But still he needs a timer, and of course `FileSystemWatcher` also. – Sriram Sakthivel Nov 13 '14 at 09:16
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:

Ric
- 12,855
- 3
- 30
- 36