FileSystemWatcher vs polling to watch for file changes
c#, distributed-filesystem, file-io, filesystemwatcher
Solution
I have seen the file system watcher fail in production and test environments. I now consider it a convenience, but I do not consider it reliable. My pattern has been to watch for changes with the files system watcher, but poll occasionally to catch missing file changes.
Edit: If you have a UI, you can also give your user the ability to "refresh" for changes instead of polling. I would combine this with a file system watcher.
Problem
I need to setup an application that watches for files being created in a directory, both locally or on a network drive. Would the `FileSystemWatcher` or polling on a timer would be the best option. I have used both methods in the past, but not extensively. What issues (performance, reliability etc.) are there with either method?