Jump to content
  • Advertisement
Sign in to follow this  
tstrimp

[.net] FileSystemWatcher Directory Deleted

This topic is 4148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a reliable way to get a recursive list of files and directories that have been deleted when a directory is deleted? When adding a directory with files in it, you get an event for the directory and each file inside of it. When it is deleted, you only get the notification that the directory itself was deleted. Not the files it contained.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Keep the list in memory so you know what files were deleted?

Share this post


Link to post
Share on other sites
So in addition to the watcher I have to maintain a directory tree that contains a list of every directory and every file within that directory? Then if one of the files in that directory gets removed I have to remove it from my list as well. If one gets added, it has to get added to my list. It seems like there should be a more elegant way of handling this.

Share this post


Link to post
Share on other sites
I don't know for sure but maybe you could find them in the recycle bin?

I guess it wouldn't be entirely reliable since things deleted by apps other than the OS shell don't go in there unless explicitly coded to do so. But it might be sufficient for your needs.

Share this post


Link to post
Share on other sites
There are ways to delete items without them going to the recycling bin (shift-delete for example). That wouldn't work very reliably.

Share this post


Link to post
Share on other sites
Bleh, my old account is pooped for some reason.. anyway..

Make sure the IncludeSubdirectories member is set to true in the FileSystemWatcher class, I tried this and an event was fired for directories and files within a directory that was deleted.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!