Content area
Full Text
The FileSystemWatcher class in the System.IO namespace can be used to monitor changes to the file system. It watches a file or a directory in your system for changes and triggers events when changes occur.
In order for the FileSystemWatcher to work, you should specify a directory that needs to be monitored. The FileSystemWatcher raises the following events when changes occur to a directory that it is monitoring.
* Changed: This event is triggered when a file or a directory in the path being monitored is changed
* Created: This event is triggered when a file or a directory in the path being monitored is created
* Deleted: This event is triggered when a file or a directory in the path being monitored is deleted
* Error: This event is triggered there is an error due to changes made in the path being monitored
* Renamed: This event is triggered when a file or a directory in the path being monitored is renamed
Creating a simple file system watcher in C#
Let's create a new console application...