I created a FileSystemWatcher (as a Windows Service) to watch for plug-ins being dropped in a directory (as ZIP files) so I can automatically unzip them, set some registry keys, and install them into my application. This works fine.
I also have the FileSystemWatcher looking to see when a ZIP file is deleted, so I can delete the install, remove the registry keys, etc. This, too, works fine...except for one catch.
When I do a delete, the file is completely deleted, but it looks like another ZIP file had been added, but it has a really strange name. Also, the contents in the registry are the same as the file I just deleted. Here is an example:
Install
-------
File: Example.zip
Extracts to: C:\Plugins\Example\*.*
Registry Key: HKLM\Software\MySoftware\Plugins\Example\[keys]
Delete
------
File: Example.zip
Directory Deletes
Registry Deletes
Creation of Folder: C:\Plugins\ER\S-1-52359402-2823975235\202\*.* where the files are the same as Example.zip's files.
Registry Key: HKLM\Software\MySoftware\Plugins\ER\S-1-52359402-2823975235\202\[keys] where the keys are the same as Example.zip's.
Those last two steps should not happen. I'm really confused on what is going on here. Is this a virus scanner that is doing it? Any help would be much appreciated.
Update: Per Jon Skeet's response, it appears that it is the Recycling Bin causing this problem (I am watching subdirectories). Is there any way to consistently ignore these directories (hidden? recycling bin? something else?).