How To Identify Which Windows Process Has Locked A File When Trying To Delete Open Files

2

winlogo.jpgSooner or later it's bound to happen. You are cleaning up your hard drive and deleting files when one of the following error messages appears:

Cannot delete [filename]: There has been a sharing violation. The source or destination file may be in use

or

Cannot delete [filename]: It is being used by another person or program. Close any programs that might be using the file and try again

No problem, you go ahead and close any running applications or programs you have open, and try to delete the file again.  Instead you get the same message and the file still can't be deleted.

More than likely a Windows process has locked the file, which cannot be deleted, until the process ends. This means you need to identify the process and kill it so you don't need to reboot your computer just to delete a file.

The easiest way to identify the process is to use a utility called OpenedFilesView from nirsoft.net.

OpenedFilesView is a standalone portable program that requires no installation and can be run from your hard drive or a USB drive.

Just download OpenedFilesView, unzip and double click on OpenedFilesView.exe.

openfileview1

To find the file that you are trying to delete, you can click on the Filename column and sort the list in alphabetical order or search for the file by selecting Edit \ Find.

openfileview2Once you find the file, take a look at the Process Name column. This will identify the process that has the file in a locked state.

Right clicking on the file will allow you to either close the file handles or kill the process.

openfileview3

Start with closing the file handle. If the file is still locked, then kill the process.

If you feel that OpenedFilesView is providing too much information, you can select which columns are displayed from the View menu (Choose Columns).

The Options menu, allows you to control which files are shown such as hidden files, network files, Svchost files, etc.

Also notice in the Options menu, you can enable OpenedFilesView in the right click context menu while working in Windows Explorer.

OpenedFilesView is a great utility to have available when removing viruses spyware that like to hide themselves in obscure folders.

Filed under Windows Tips by  #

Comments on How To Identify Which Windows Process Has Locked A File When Trying To Delete Open Files Leave a Comment

March 6, 2012

JoshuaReen @ 3:51 pm #

I love this tool and am using it now for this type or errors. I have tried a number of ways for it, and also I have used “Long Path” Tool in this situation and it helped me easily and quickly.

August 21, 2013

garrydam @ 11:26 pm #

I just download and use "Long Path Tool" guarantees to fix your error fast and easy.

Leave a Comment

Fields marked by an asterisk (*) are required.

Subscribe without commenting