Re: How to Find Process ID Holding Lock on Folder?

  • Thread starter Thread starter VanguardLH
  • Start date Start date
V

VanguardLH

W said:
I have a file folder I cannot delete because some process is holding it
open. After reviewing open applications and processes in Task Manager, I
cannot locate this process. Is there any application that would let me
point to any file object and then tell me which processes currently have
open locks on the file?

Unlocker
http://www.emptyloop.com/unlocker/
Will tell you what process has the lock WHEN you attempt to delete or
rename the file/folder. The folder would be locked (from deletion)
because a file under it has a file handle still assigned to it from an
active process - and that process can be explorer.exe itself (used for
both the Windows Explorer app and also manages the Windows desktop).

Because it could be explorer.exe that has a lock on the file, you could
unlock the file to delete it by doing the following:

- Load Task Manager.
- Kill all instances of explorer.exe process.
- Your Windows desktop disappears (because explorer.exe is gone).
- Use File -> New Task menu in Task Manager to run "cmd.exe".
- Use the command console to delete the file(s) under the folder and
then delete the folder, or try "del /s <folder>".
- Use File -> New Task menu in Task Manager to run "explorer.exe".
- Desktop reappears.

You're unloading the explorer.exe to delete the file on which this
process had a lock.
On a more general level, I cannot believe that no one has written a system
gadget that will just list all open file resources on your computer and
which processes use those. It would go a long ways towards finding
software you don't want running to see which resources are currently in use.

Nirsoft's OpenedFilesView
http://nirsoft.net/utils/opened_files_view.html
 
W said:
VanguardLH wrote ...


OpenedFilesView is a wonderful tool. Thanks for the recommendation.

I've also seen a 3rd party (non-Microsoft) task manager replacement that
lists the file handles opened by each process. I think it was
Auslogics' Task Manager. You can click on its Locked Files category in
the left pane to see all files that are locked (exclusive write access)
and which process has the lock on the file. I haven't used this product
to know if you can then right-click on the locked file to unlock it
(since I already have Unlocker which works automatically for me to check
for locked status on a rename/delete and prompt me for an action).

http://www.softpedia.com/dyn-search.php?search_term=auslogics+task+manager

SysInternals' Process Explorer (which can be configured to replace
Windows' Task Manager or used as a separate app) lets you see which
files are opened by each process. It's not obvious in Process Explorer.
Instead of showing opened file handles for a process as a property of a
process, you have to show the lower-pane view (View -> Lower Pane View
-> Handles).

Nirsoft's OpenFilesView is handy because you only know that a file has
an open handle on it (why you cannot rename or delete it) but don't know
process has the opened handle on that file. Process Explorer will also
let you search on an open file handle using Find -> Find Handle or Dll
menu. In the search dialog, enter all or some of the file's name on
which to search and a list of processes come up for which ones are
accessing that file. Alas, you may see more than one process showing a
link to a file since not all of them have a lock on it (they don't
demand exclusive write access).

Then there is the oh.exe command-line tool that you can download as part
of the Windows 2000 Resource Kit at:

ftp://ftp.microsoft.com/ResKit/win2000/

After unzipping the file, run "oh.exe /?" to get help on its syntax.
But first you have to run oh.exe, reboot, and then use it.
 
Back
Top