How to get the directory deleted by _rmdir for immediate update in Windows Explorer?

I have a Win32 program that will delete a directory if it deletes all the files in it. Deleting a directory is completed successfully, and the directory is deleted, but until the program exits, the directory will still be displayed in the Windows Explorer window. Attempting to open a folder in Explorer will result in a pop-up error message: "Location not available" "not available. Access denied." [OK].

Calling _unlink () for files in updating folders in the Explorer window almost immediately. Is there a way to "reset" the file system, in addition to exiting the program. Usually the program runs for several days, so the presence of phantom folders that give errors before the program exits is unacceptable. Is there a way to do this using _unlink () or will I have to switch to the version of the Windows API call?

+5
source share
1 answer

Do you store any descriptors in this directory? Use Process Explorer to check for files containing its name.

Since Windows Explorer shows the directory while the application is running, but stops showing it after it exits, the problem is that your application holds a handle to a descriptor or file in this directory, which somehow prevents the directory from completely deleting or tricking Windows Explorer. assuming that it is still in the file system.

+3
source

Source: https://habr.com/ru/post/1200969/


All Articles