FileSystemWatcher keeping parent directory
Posted
by Henry Jackson
on Stack Overflow
See other posts from Stack Overflow
or by Henry Jackson
Published on 2010-06-02T20:39:37Z
Indexed on
2010/06/02
20:44 UTC
Read the original article
Hit count: 282
.NET
|filesystemwatcher
I am using FileSystemWatcher
to monitor a folder, and it seems to be preventing the folder's parent from being deleted.
For example, I have the file structure:
C:\Root\FolderToWatch\...
with the FileSystemWatcher
targeting FolderToWatch
. While my program is running, if I go to Windows Explorer and try to delete Root
, I get an error "Cannot delete Root: access is denied".
However, if I delete FolderToWatch
FIRST, I can then delete Root
without incident. (Needless to say, if the FileSystemWatcher
is not enabled, I have no problem deleting either folder.)
- What gives? Why does the
FileSystemWatcher
hang onto it's target's parent like that? - How (if possible) can I stop this behavior? I would like the user to be able to freely move or delete directories in Windows Explorer.
© Stack Overflow or respective owner