Other than reading all the files and comparing them with a previous snapshot, is there a way to detect when a directory changes in C# with Windows? I don’t mind PInvoke if that’s what it takes.
EDIT The FileSystemWatcher class is great, but one gotcha is that you must kick off any work in the callback notification to a background task/thread to avoid blocking which will cause dropped events.
Use the FileSystemWatcher class – it does what you want. It won’t tell you which bytes in the file changed, but it will tell you which files have changes.
From the doc: