I want to monitor the following
- New File being created/copied to the directory
- Existing file edited
I use the following code to subscribe to the created
and changed
event of the FileSystemWatcher class.I have noted some issues with FSW Class.
- On replacing files, the changed event is getting triggered numerous times.
How can i get over this issue.Kindly advice.
watcher.Path = watchpath;
watcher.Filter = "*.*";
watcher.Created += new FileSystemEventHandler(copied);
watcher.Changed += new FileSystemEventHandler(Watcher_Changed);
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.EnableRaisingEvents = true;
For a single item copied to the folder,the following events are raised
*******> Created
-----> Changed
-----> Changed