I have a Win32 program that will delete a directory if it has deleted all files in it. The directory delete succeeds and the directory is deleted but until the program exits, the directory will still be displayed in a Windows Explorer window. Attempting to open the folder in Explorer will produce a pop up error message to the effect: "Location is not available" " is not accessible. Access is denied."[OK].
Calling _unlink() for files in a folder update in an Explorer window almost immediately. Is there some way to "flush" the file system other than exiting the program. The program is typically left running for days, so having phantom folders that give errors until the program exits is not acceptable. Is there a way to do this with _unlink() or am I going to have to switch to Windows API version of the call?
Do you hold any descriptors to that directory? Use Process Explorer to check for file handles containing its name.
Since Windows Explorer is showing the directory while the application is running, but stops showing it after it exits, the problem is likely that your application is holding a handle or file descriptor to that directory, which somehow keeps the directory from being completely deleted, or it tricks Windows Explorer into thinking it still is in the file system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With