How to find which process has a file open

Error 1:

Error Deleting File or Folder

Cannot delete FolderName: Access is denied.

Make sure the disk is not full or write-protected

and that the file is not currently in use.


Error 2:

The action can't be completed because the folder is open in another program

Close the folder and try again



How to find which process is holding the file

I am sure you have come across instances where you tried to delete a folder or file and Windows would not allow you and would popup with a message box which had a message something like the errors listed above.

These messages can be very frustrating at times because it does not tell you which process is holding a lock on the folder or file, but just says some process is holding it.  Is there a way to know which process is holding the folder or file that I am trying to delete?

There are many tools available to know the process which is the culprit. Most reliable of all the tools available in my opinion is the one from Microsoft itself. Its called the Process Explorer. You can download the tool from here.  Process Explorer

Download the tool and extract the files and run the procexp.exe

Now to find the process having a hold on your folder or file:

1.       Goto the Find Menu

2.       Select Find Handle or DLL menu item.

3.       This should bring the Process Explorer Search Window

4.       Enter the Name of the Folder or File you are trying to delete and click on Search button.

5.       The tool should list the Process which has a hold your Folder or File.

6.       Select the Process. Selecting the Process in this Search Window will also highlight the Process in the Main Window of the Tool.

7.       Right-Click on the Process in the Main Window and Select Close Handle.

That’s it, that should release the handle on your Folder or File and now you should be able to delete your file or folder.

Hope that was helpful!