Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Find Process ID Holding Lock on Folder?

2,090 views
Skip to first unread message

W

unread,
Mar 2, 2012, 11:25:01 PM3/2/12
to
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? I did use Sysinternals Process Manager, and
whatever process holds the lock is not doing any active work against it.
No messages were generated inside of Process Manager when searching for a
string in the filepath to the folder. When I opened Explorer and manually
went to that folder, Process Manager detected that activity.

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.

--
W


VanguardLH

unread,
Mar 3, 2012, 1:25:10 AM3/3/12
to
W wrote:

> 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

John John MVP

unread,
Mar 7, 2012, 6:05:20 AM3/7/12
to

W

unread,
Mar 7, 2012, 7:18:32 PM3/7/12
to
"John John MVP" <aude...@nbnot.nb.ca> wrote in message
news:jj7fc5$onl$1...@dont-email.me...
How do you use process explorer to locate all processes that lock a specific
file or folder? I see a way to select each process and manually go through
every file resource it holds open, but that isn't exactly convenient or
fast.

--
W


VanguardLH

unread,
Mar 8, 2012, 1:27:16 AM3/8/12
to
W wrote:

> John John MVP wrote ...
>
>> W wrote:
>>
>>> I have a file folder I cannot delete because some process is holding
>>> it open.
>>
>> Handle or Process Explorer by Sysinternals or the OH.exe (Open
>> Handle) utility from Microsoft.
>
> How do you use process explorer to locate all processes that lock a specific
> file or folder?

Well, how about using the Find button in the toolbar? Since you already
know the folder or file name that's locked, search on that.

Read PE's own help. Under the Contents tab showing a tree list of
topics, read the "Process Explorer -> Searching" node.

W

unread,
Mar 17, 2012, 6:07:15 PM3/17/12
to
"VanguardLH" <V...@nguard.LH> wrote in message
news:jisdfu$3iv$1...@news.albasani.net...
OpenedFilesView is a wonderful tool. Thanks for the recommendation.

--
W




VanguardLH

unread,
Mar 17, 2012, 8:28:24 PM3/17/12
to
W wrote:

> VanguardLH wrote ...
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.
0 new messages