

Intializes a new instance along with a Path and Filter propertiesįileSystemWatcher myWatcher = new FileSystemWatcher("c:\\","*.txt") Intializes a new instance with a Path propertyįileSystemWatcher myWatcher = new FileSystemWatcher("c:\\") Intializes a new instance of the FileSystemWatcher ClassįileSystemWatcher myWatcher = new FileSystemWatcher() To create an instance of the FileSystemWatcher component use one of the following: Ĭreating FileSystemWatcher Component Instances: Configure necessary properties and methods for the component.Create an instance of the FileSystemWatcher component.To configure an instance of the FileSystemWatcher component,
Windows watch folder for changes code#
Also you can watch a remote Win2000 and Win2000.įor the code in this article you will need:Ī text editor, such as Notepad, Text pad or Visual Studio. But, you can watch a remote Win2000 and local WinNT 4.0 and vice versa. You cannot watch a remote Windows NT 4.0 computer from a Windows NT 4.0 Computer.

FileSystemWatcher only works on Windows NT 4.0 and Windows 2000. The component can watch files on a local computer, network drive or a remote machine.

For example, if you are watching a directory called c:\Mydir, the component will monitor changes within the directory but not changes to the directory itself. The FileSystemWatcher component is designed to watch for changes within the directory, not to changes to the directory's attributes themselves. It is one of the members of System.IO namespace. This makes it possible to easily detect when certain files or directories are created, modified or deleted. In part 2, a sample application, which helps you to monitor a specified directory.įileSystemWatcher is a very powerful component, which allows us to connect to the directories and watch for specific changes within them, such as creation of new files, addition of subdirectories and renaming of files or subdirectories.
Windows watch folder for changes how to#
In this article, I am explaining you how to use FileSystemWatcher class in Part 1. FileSystemWatcher, which watches your directory for any change using. NET you can do it through a simple and flexible component i.e. Earlier, writing this kind of application is too difficult, but with. If any one is experimenting your important directory without your notice, then you may think of an application, which helps you to monitor the changes of your directory.
