C# .NET - how to use filesystemwatcher over network for sharedfolder

Asked By mohan kumar on 26-Jul-12 11:27 AM
Hi,
     I need to monitor the shared folder by using filesystemwatcher, if any modification in the folder i like to update file in local folder. Please give the solution  filesystemwatcher for networkfolder(how to monitor folder if any shared folder connection lose) or sample code or project.
Peter Bromberg replied to mohan kumar on 26-Jul-12 03:13 PM
The MSDN documentation states that you can use the FileSystemWatcher class to monitor changes on a network drive.
See here:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.100).aspx 
mohan kumar replied to Peter Bromberg on 28-Jul-12 12:26 PM
Hi peter,

           How to check the filesystemwatcher is disconnected or connected on shared folder monitoring. Please give solution for this and how to reboot the filesystemwatcher to monitor the folder
Peter Bromberg replied to mohan kumar on 28-Jul-12 12:48 PM
The FileSystemWatcher is a class. When instantiated, it starts monitoring and doesn't stop until the instantiated object is disposed. You can find numerous examples of code that uses this with a simple google search. One common usage is to have this run inside a custom Windows Service that you write.