Check directory's sharing mode in windows
My question is seems to be simple, but google is silent. I'm banned may be?:)
So the que开发者_StackOverflow中文版stion is can I check is there any blocked from deleting file in directory or it's subdirectories before delete it? Is there simple way to do it?
No, there isn't.
And even if there was, it wouldn't work. Consider this sequence of events:
- You perform the check and it succeeds (there is no blocked files).
- Another process receives CPU quantum and opens a file without FILE_SHARE_DELETE flag.
- Your process gains the CPU back and proceeds to delete the directory -- only to discover that it can't, because now there is a blocked file.
精彩评论