Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to delete some folder but this error is preventing from doing it:

Cannot delete [FileName]: It is being used by another person or program.

Close any programs that might be using the file and try again.

How can I identify what application is using the file?

I want to end the application using a Task Manager, but I didn't know what application is using it.

The folder is not shared and my user account is an administrator.

share|improve this question
1  
See this ServerFault question. –  John Fouhy Jul 17 '09 at 3:34
    
Is your file a video? You may find that Windows Explorer itself is "using" the file... –  DisgruntledGoat Mar 12 '12 at 10:32
add comment

10 Answers

Have a look at Process Explorer (procexp.exe).

From it's introduction:

Ever wondered which program has a particular file or directory open? Now you can find out.

To find out what process is using a specific file follow these steps:

  1. Go to Find, Find Handle or DLL.. or simply press Ctrl+F.

    enter image description here

  2. Enter the name of the file and press Search.

    enter image description here

  3. Process Explorer will list all processes that have a handle to the file open. Click on an entry to focus the process in the main window.

    enter image description here

  4. Optionally, you can then even close the handle manually through the lower pane (Ctrl+L):

    enter image description here

share|improve this answer
    
Process Hacker also can do it. –  Benoit Mar 12 '12 at 10:41
    
Process Explorer did the trick in finding which app was using the folder for me –  saravanan Apr 11 '13 at 12:05
1  
As another answer mentions, Handle is a command line tool from SysInternals that will also accomplish this task. –  heavyd Dec 11 '13 at 22:35
add comment

For Windows 7 and Windows 8 you can use the built-in Resource Monitor for this.

  1. Open Resource Monitor, which can be found
    • By searching in the start menu, or
    • As a button on the Performance tab in your Task Manager
  2. Use the search field in the Associated Handles section on the CPU tab
    • Pointed at by blue arrow in screen shot below

In case it's not obvious, when you've found the handle, you can identify the process by looking at the Image and/or PID column.

You can then close the application if you are able to do that, or just right-click the row and you'll get the option of killing the process right there. Easy peasy!

Resource Monitor screenshot

share|improve this answer
3  
Thanks for the details. –  wil Sep 10 '13 at 16:18
    
Note: the Resource Monitor didn't find any associated handles in my case whereas Process Explorer (as described above) did. –  ComFreek May 6 at 16:57
    
@ComFreek Well, ProcessExplorer might be more powerful in many cases, but for me Resource Monitor have always found the application locking the file I'm trying to do something with. I also prefer it to Process Explorer simply because it's right there in the OS. No need for an extra download and an extra shortcut somewhere. –  Svish May 6 at 21:16
add comment

Unlocker should do the trick.

You can select a file by running the program, or just use the right click context menu:

Screenshot of Unlocker (context menu)

Screenshot of Unlocker (main program)

share|improve this answer
    
Works well... and you beat FigBug by seconds with it ;) –  jerryjvl Jul 18 '09 at 0:19
2  
Downvote because unlocker has a toolbar bundled with the installer. –  Nathan Adams Jan 5 '13 at 22:21
1  
Yes be careful when installing, Unlocker comes with other softwares you might not want, so you can skip it. –  MaxiWheat Jan 11 at 18:29
add comment

EMCO UnlockIT can identify the process that has locked the file as well as unlock the file so that you may delete/edit/move it. The program is completely free, though the newer version is a bit slower and more bloated than the original (which had a plain, unskinned GUI, but loaded pretty much instantaneously and without an annoying splash screen). Also, the original version used to pop up automatically whenever the error you mentioned is triggered, allowing you to instantly unlock the file and perform the operation you were attempting.

Still, UnlockIT is an incredibly useful program that provides a basic functionality that is critically missing from Windows. It's among the standard toolkit of utilities that I install on all Windows computers I work on.

share|improve this answer
    
@John: Well, it does identify the program that has locked a file. And you can still manually kill the process through task manager. However, it's usually simpler to just unlock the file (especially when it's explorer that has locked the file most of the time) instead of having the kill the process that has locked it (usually due to having accessed the file and left the file handler open due to a program glitch). –  Lèse majesté Mar 12 '12 at 3:46
add comment

LockHunter can unlock any handlers that may have locked your files or folders. Unlike similar freewares, it supports both 32 and 64-bit Windows.

It is a free tool to delete files blocked by something you do not know. LockHunter is useful for fighting against malware, and other programs that are blocking files without a reason. Unlike other similar tools it deletes files into the recycle bin so you may restore them if deleted by mistake.

  • Shows processes locking a file or folder
  • Allows to unlock, delete, copy or rename a locked file
  • Allows to kill locking process
  • Allows to remove locking processes from hard drive
  • Integrates in to Explorer menu
  • It deletes files into the recycle bin, so you may restore them if deleted by mistake
  • Supports both 32 and 64bit Windows
share|improve this answer
add comment

I like WhoLockMe. Shows up as an explorer extension, really handy.

share|improve this answer
add comment

Additional possibility, just to save people the time I just spent:

In older versions of Windows, you might get "Access Denied - you might not have rights, or the file might be in use". If you find through Process Explorer that the files are, in fact, not opened by anyone, odds are that there is an issue with security. Using an administrator account, select the files in Explorer, right-click and select Properties, Security, Advanced, Owner. Odds are that the files are owned by an account that no longer exists or can no longer be verified to exist (because of changing Active Directory trust settings).

Change ownership to Administrators and you are good to go.

share|improve this answer
add comment

Here was my discovery & solution.

Incidentally, none of the above answers solved my problem.

I even tried using UNLOCKER which proved worthless.

My problem was that of Memeo Autosync Backup

Apparently, this backup process leaves enough of a "ghost like file." This "ghost like file," would show up whenever I would ALT-TAB my computer (Windows Professional XP), i.e. I would see TWO MS Excel Programs running, when I only had ONE visible, on my TASK BAR.

I came across this solution when I thought it might have been the SYMANTEC Endpoint (Anti-Virus) Protection; and disabled the program. However, I kept getting the error message:

cannot delete (LARGE.xls file): It is being used by another person or program. Close any programs that might be using this file and try again.

I subsequently kept seeing the Memeo notice of "syncing" and QUIT the program.

Subsequently, NO ERROR.

For you, it could be ANY of these background saves.

share|improve this answer
add comment

If you do not know the program the file it is using then you can go to My Computer; right click; select Manage. Under System Tools > Shared folders > Open Files, you should be able to see the user who has locked the file. You can close file from here and then you can perform the task of rename or delete the file. Hope this helps

share|improve this answer
    
This will only work for shared folders. –  sweetfa Aug 14 '13 at 3:57
add comment

protected by slhck Nov 26 '13 at 7:05

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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