I've seen people mention hooking a call to file open into a timer. Is
there no better way to do this? Seems like there should be a much
simpler mechanism available by now.
The only way I have gotten around this is to have whatever process
writing the file write a "marker" file. A zero byte file to indicate that
the file writing is complete. Then, when the FileSystemWatcher detects this
file, it determines (from the filename is the system I used) the name of the
file to process, and when it is done, deletes the marker file, or both.
If you can't change the process that is outputting the file, then a
timer is really the only way you can do this. Either that, or if you know
that the process writing the file will have exclusive access to the file,
cycle in a loop (waiting in between so you don't spin the processor
needlessly) until you can get access to the file, or you time out (as
specified by you).
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Bob" <B...@no-spam.com> wrote in message
news:fichp39t9ffv59h11...@4ax.com...