Monitor the file system with FileSystemWatcher in C# .NET
January 4, 2017 Leave a comment
In this post we’ll look at how you can use the FileSystemWatcher object to monitor the Windows file system for various changes.
A FileSystemWatcher object enables you to be notified when some change occurs in the selected part of the file system. This can be any directory, such as “c:\” or any subdirectory under the C: drive. So if you’d like to make sure you’re notified if a change occurs on e.g. “c:\myfolder” – especially if it’s editable by your colleagues – then FileSystemWatcher is a good candidate.
Consider the following Console application:
