Sometimes when I'm working in Windows I'll get this prompt when I try to delete a directory:

Folder In Use
The action can't be completed because the folder is open in another program
Close the folder and try again.

However, the folder isn't "in use" at all, and I don't have it open. So how can I delete it short of rebooting?

link|improve this question

50% accept rate
feedback

9 Answers

up vote 10 down vote accepted

Process Explorer from Sysinternals will let you search through the handles and DLLs. Search for the directory and find out which process is "using" the folder.

From there, you have the ability to either shut down that process, or just close that particular file handle. Be sure about what you're doing when working with the file handle directly, and make sure it's not being used by some important process.

link|improve this answer
feedback

Try this nice tool: http://ccollomb.free.fr/unlocker/.

link|improve this answer
1  
A common culprit on my end is TSVNCACHE, a helper program for TortoiseSVN. – Lasse V. Karlsen Jul 15 '09 at 17:19
I've had great luck with Unlocker – spaetzel Jul 15 '09 at 17:20
feedback

When using tools that forces file handles closed (like the previously-mentioned Unlocker), keep in mind that doing so might cause serious problems. (See this article by Raymond Chen.) Make sure you know which applications are using the file and that none of them are doing anything important.

It's safer to try shutting down the applications first instead of just forcing the handle closed.

link|improve this answer
feedback

Unlocker and WhoLockMe don't work on 64-bit Windows. I use LockHunter.

link|improve this answer
feedback

I've had that happen to. Sometimes I can resolve the issue by deleting the contents first, then the folder(empty).

link|improve this answer
feedback

When I was on XP I used WhoLockMe to find out what programs had files open and locked. The most recent version I could find doesn't mention Vista, but it'd be worth a shot.

Sometimes, you can delete it from the inside out manually. Just navigate all the way down in the hierarchy, delete all files, move up a directory, and repeat. Not sure why Windows can't do this itself, but it sometimes works for me.

link|improve this answer
feedback

I use Handle from SysInternals (now Microsoft). You can type in part of the folder name to see which process has a handle on that folder and then kill the handle.

Like others have mentioned, killing the handle can cause serious problems.

link|improve this answer
feedback

The quickest and simplest approach is to use Handle, as mentioned by slolife, rather than using Process Explorer. They're both from Mark Russinovich @ Microsoft.

Don't be surprised to find that explorer.exe is the culprit, as I did today. Apparently there is an official way to restart explorer.exe, but I seem to be getting away with killing it and starting it back up again it in Task Manager.

link|improve this answer
feedback

If by “not in use”, you mean there are no open handles to it, then make sure that the Application Experience service is not disabled. If so, set it to manual:

Run dialog (or command prompt):

  sc config AeLookupSvc start= demand
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.