Common file system operations might raise more than one event. For example, when a file is moved from one directory to another, several OnChanged and some OnCreated and OnDeleted events might be raised. Moving a file is a complex operation that consists of multiple simple operations, therefore raising multiple events. Likewise, some applications (for example, antivirus software) might cause additional file system events that are detected by FileSystemWatcher.
What you will likely need to do is buffer the events coming out of the
FileSystemWatcher
.
Something like the following might
work[
^].
You might want to do some digging around for other implementations, as I'm not familiar with that but it seems like that could prove useful as a starting point.
Enjoy.