Created directory is locked by explorer.exe, can't delete it
Posted: Mon Dec 15, 2008 5:57 pm
Hi
I just ran into a weird problem I've never seen before.
I use Windows XP Home SP3. F-Secure firewall & anti-virus. Recently re-installed and should be a fairly clean system, not much programs installed.
I am developing a console program (C++) which opens a package file, reads its contents, and writes out its contents into a directory which has the basename (extension dropped) of the package file as its name.
I am using boost::filesystem::create_directory to create the directory if it doesn't exist.
Now, what happened is that after I ran the program with a certain package file as input, it created the directory just fine - empty one this time because I was just testing. But the problem is that I can't delete the directory through explorer or through console. Windows says that the directory is in use by some process.
The name of this directory is BMP2. Other package files which have different names don't have the problem, I can delete their directories just fine.
I carefully checked that this program that created the directory is not running anymore, so it can't be the one that is preventing the deletion of the directory. The program exits normally and does everything just like I want.
I checked which process is using the directory by using Process Explorer (sysinternals/microsoft), and it says that explorer.exe is using the directory. Then I close the file manager, console, visual studio, and the directory is still in use by explorer.exe and it still can't be deleted of course.
What can cause this? Is this a Windows XP bug, or perhaps caused by anti-virus program? Or by something else?
What I am going to do next is to reboot my computer and see if the problem goes away. I expect it to go away.
But anyways I would like to hear what can possibly cause this problem and if there are anything that I can do to prevent it from happening, and why it happened for that one directory named BMP2 but not for the others.
I just ran into a weird problem I've never seen before.
I use Windows XP Home SP3. F-Secure firewall & anti-virus. Recently re-installed and should be a fairly clean system, not much programs installed.
I am developing a console program (C++) which opens a package file, reads its contents, and writes out its contents into a directory which has the basename (extension dropped) of the package file as its name.
I am using boost::filesystem::create_directory to create the directory if it doesn't exist.
Now, what happened is that after I ran the program with a certain package file as input, it created the directory just fine - empty one this time because I was just testing. But the problem is that I can't delete the directory through explorer or through console. Windows says that the directory is in use by some process.
The name of this directory is BMP2. Other package files which have different names don't have the problem, I can delete their directories just fine.
I carefully checked that this program that created the directory is not running anymore, so it can't be the one that is preventing the deletion of the directory. The program exits normally and does everything just like I want.
I checked which process is using the directory by using Process Explorer (sysinternals/microsoft), and it says that explorer.exe is using the directory. Then I close the file manager, console, visual studio, and the directory is still in use by explorer.exe and it still can't be deleted of course.
What can cause this? Is this a Windows XP bug, or perhaps caused by anti-virus program? Or by something else?
What I am going to do next is to reboot my computer and see if the problem goes away. I expect it to go away.
But anyways I would like to hear what can possibly cause this problem and if there are anything that I can do to prevent it from happening, and why it happened for that one directory named BMP2 but not for the others.