Advertisement Jump to content
Sign in to follow this  
BeanDog

[.net] FileSystemWatcher--File moved?

This topic is 4822 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

It seems that finding out if a file has moved using the FileSystemWatcher class is a total pain. In my experiments, a file move tends to raise the following events: 1. Created (for new file) 2. Changed (for new file, possibly multiple times) 3. Changed (for new folder) 4. Deleted (for old file) 5. Changed (for old folder) I'm writing a class that simply spits out a FileMoved event when this happens, and it's been a royal pain to get it to work reliably. I've tried storing a cached version of all the file info in the directory tree I'm watching, then on every Deleted I check if the file info for the last file that was created and the cached file info for the file that was just deleted match up in terms of filename, modified timestamp, and size. It's a very bad hack and doesn't work very well. Has anyone here done this or have a good link? ~BenDilts( void );

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!