C# FileSystemWatcher.Deleted not Firing on "normal" deleting?

I know it's an old question, but I resolved this by adding FileName to the NotifyFilter property of the FileSystemWatcher object.


This is expected behaviour as the file isn't actually deleted: it's moved.

Try attaching to

filesystemWatcher.Renamed

and checking if the file is moved to the Recycle Bin instead.

Finding where the recycle bin actually is in the filesystem is not trivial, mind you. Some code posted by others (untried) is here: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/5d2be9aa-411c-4fd1-80f5-895f64aa672a/ - and also here: How can I tell that a directory is the recycle bin in C#?

Tags:

C#

.Net