# How do I delete a folder that's in use?

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?

This answer is old, but seems to still get traffic. As noted below, there is a built in tool in Windows now:

Start → All Programs → Accessories → System Tools → Resource Monitor (or Run resmon.exe)

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.

• But how I find directory which is used by process? Sep 11, 2013 at 10:14
• Use Ctrl-F and enter the name of the folder above the one you are trying to delete. May 6, 2014 at 20:58
• There is now a native GUI for Windows, see my answer below. Jun 27, 2014 at 20:48
• *Native GUI /built into/ Windows (Resource Monitor) see below. Nov 7, 2014 at 5:43
• In my case, Process Explorer was not able to find the handle, but the Resource Monitor (see other answer) was capable. Mar 1, 2016 at 6:34

There's a native GUI for Windows:

Start>>All Programs>>Accessories>>System Tools>>Resource Monitor (or Run resmon.exe)

You can search for the "Associated Handles" using the searchbox (circled in red), and right click the process you want to end.

As an example, in the image below I could not delete my Eclipse directory. Searching for the Eclipse associated handles showed that the adb.exe had a handle to the directory. After ending the adb process, I could then delete the Eclipse directory.

• This trick highlighted the process that was giving me grief :) Aug 28, 2014 at 11:32
• Resource Monitor requires administrator credentials.
– Air
Nov 23, 2015 at 19:09
• I have a locked folder on my desktop that resource monitor does not list as being used. Oh well. Dec 11, 2015 at 17:06
• locked? This is to solve the particular error in the question, i.e. "the folder is open in another program." Is this your situation? Dec 11, 2015 at 17:39
• Solved the problem for me. Apr 24, 2016 at 8:27

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

• Unlocker comes for 64-bit system. Apr 14, 2013 at 1:58
• lockhunter found the locking process for me that both ProcExp and ResMon could not find. Jan 24, 2018 at 14:17
• that LockHunter application is pretty damn sweet. Where have you been all my life?
– Andy
Mar 17, 2020 at 17:59
• LockHunter solved the problem. May 19, 2020 at 20:28
• Prevented a restart. Awesome solution. Mar 24 at 19:11

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

• Yes - it worked for me! Jan 21, 2013 at 13:04
• @Wbdvlpr, @ kpoehls, Why would this work? I think it's just a myth and you happen to be lucky. Jun 8, 2015 at 20:20

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.

• Way good article. Important read. Jun 8, 2015 at 20:17

This REG script will give you a "View Handles" right click context menu item which will invoke the Sysinternals handle utility to see all open handles to the file or folder that you right clicked on.

Put handle.exe from Sysinternals into a location that is accessible from your path.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Handle]
@="View &Handles"

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shell\Handle\command]
@="cmd.exe /k handle -a -u \"%1\""

• Why not just use the UI version ProcessExplorer? Jun 8, 2015 at 20:19

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.

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.

handle64.exe -nobanner "<path>"


For example:

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

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.

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


I've had the same problem with a memory flash (16 gb - irrelevant probably) and it wouldn't let me delete a folder. I tried every -freaking- solution found on internet (hiding thumbnails, deleting the folder from the cmd prompt with explorer.exe shut down, everything..) and nothing worked. What made it work? Well, this:

1. Select all the files inside the folder
2. Right click on them and select "Cut"
3. Go back to the root folder
4. Paste them
5. Delete them

That worked just fine for me. Hope I helped. :-)

In order to delete a folder/program that says you can't delete it because is open somewhere else.

• Click start button
• In the new window that opened, under process tab, look for the folder/program you're trying to delete.
• Right click it and End Task
• Go back to the folder/program location and you should be able to delete it now

Try Ctrl + Shift + Esc > "programs", then right click the one you want to deactivate and choose deactivate. Then delete it again!

(My OS is in Swedish so the translations might not be exactly the same! but you get it!)

oft times the handle that is locked is internet explorer, i either close it in task manager, then delete the file or folder or close explorer...often a folder has a txt file that is open and that will be the handle that won't let u delete folders/files...just close the txt file and then u should be fine, u can now delete ur folder.

• Why would IE lock local files and why .txt? Aug 25, 2013 at 14:06

Had a file docs.zip in use by WinSCP.

1. I created a new file using same name docs.zip
2. Pasted over existing docs.zip and the old file got replaced by new same named file.
3. Then I deleted the newly copied file docs.zip all together.

Good Luck

So there are already some good answers, but I'm going to contribute something new, which is what I used to resolve this same issue earlier today.

I used Python. I know, I know, it's not native to Windows, but it's very a very common utility for sysadmins, developers, and super users, and you can knock this out with a simple oneliner:

from shutil import rmtree; rmtree('C:\path\to\folder')

...bingo bango.

1. Find the file that you want to delete.

2. Rename it to anything you like.

3. Delete it.

• This answer will not work. If a file or directory is use you can't rename it. Apr 2, 2016 at 6:49
• I was thinking this must be a really old win95-98 trick. If anyone could confirm I'd be joyful. Oct 1, 2020 at 1:05

go into the folder all the way down to the file or files being executed. when you try to delete this file it will give you what process it is running . write that down, then go to the task manager and end that process .. after that you can delete the folder.