I am writing a tool that monitors a network directory and is running off of a Windows Server 2008 machine, the OnChanged event for the FileSystemWatcher is being fired correctly from files placed on the network drive by any computer that is not using Windows 7, for some reason if the amount of files copied is more than 19 on a windows 7 computer (at once) then no events are fired although it works if files are done individually. Is there a workaround for this or is that just how the Windows 7 kernel behaves with FSW events?
Just to clarify it works for thousands of files when copied from an XP machine. (The software is still on the 2008 server machine).
From MSDN:
If increasing the buffer size is not sufficient and you cannot control how many files are triggering events at a time you would have to add additional polling.
See also this related question:
Update:
It might be tempting to simply increase the buffer size but this should be done with care. In fact, there is a 64k limitation when it comes to network access. The
FileSystemWatcherclass is using the Windows API functionReadDirectoryChangesWunderneath which has this limit:If you want to get a deeper understanding on the cost of modifying the buffer size you should have a look at the post of Walter Wang of Microsoft here: