Question about FileSystemWatcher

D

dinny

Question about FileSystemWatcher:
How can I determine if a delete notification was
a file or a directory. I was using the DirectoryInfo.exists
method to determine if I am receiving file or direcory
notifications, but with the delete notification the file is no
longer there, so I don't know how to find out if the path
was a file or a directory?
 
J

Jay B. Harlow [MVP - Outlook]

Dinny,
As you found out the file or directory does not exist any longer in Deleted
event.

You may try using two FileSystemWatcher objects. One that watches for
Directories only and the second watches for Files only.

Unfortunately I have not used FileSystemWatcher enough to know what
properties you need to set to get a FileSystemWatcher to watch for
Directories only...

I'll post something if I come up with something...

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top