Saturday, October 11, 2008

Monitoring File System using FileSystemWatcher Class

The FileSystemWatcher class is used to watch for changes in a specified directory. You can watch for changes in files and subdirectories of the specified directory. Also you can create a component to watch files on a local computer, a network drive, or a remote computer.

The FileSystemWatcher is designed to watch for changes within the directory, not to changes to the directory's attributes themselves.

The Windows operating system notifies your component of file changes in a buffer created by the FileSystemWatcher. If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification. To avoid a buffer overflow you can filter out unwanted change notifications.

Read the entire article here


No comments: