FileSystemWatcher Events and incomplete file errors
This is a question that has popped up numerous times, and I myself have had to deal with it: You get a FileSystemWatcher event that a new file was created in a folder you are monitoring. So you try to process the file, but problems arise because the process that has written the file isn't finished writing it yet. One way to handle this is to have the process that is writing the file send a second small text file consisting of something like the name of the file just written and the datetime that it was completed. You would get an event that this new file had been written, and your code logic would tell you what to do at this point. Of course, this assumes that you have sufficient control over the file - writing process to make this change. One newsgroup poster commented, "We're running a windows service which contains several filesystemwatchers. Sometimes we hit spikes of 20-50.000 files in a matter of seconds and each file can potentially take some time to process. The...