Search code examples
c#filesystemwatcher

FileSystemWatcher renamed event not raised when I rename the folder it's watching out


I've configured a FileSystemWatcher in order to it watches out on a folder C:\folder.

It's suddenly come up me a problem when I've changed the name of the folder it's watching out to another one, and it doesn't raise anything.

The question is: Does a FileSystemWatcher raise some event when changes are made on the same "object" it's watching out?


Solution

  • Renaming the directory you are watching will not raise a notification. Notifications are only raised for entries inside the directory you are watching. That is expected behavior which is explicit documented in remarks block for FileSystemWatcher.Renamed Event.