Database.ca SQL Server Blog

My Blog

Tuesday, February 25 2014

Keywords: find locate locked files folders Windows process locking delete move open in another program applicaiton process

Find what is locking in-use files and folders in Windows quickly, and unlock them

If you try to move or delete a file or folder, and this action cannot complete because the file or folder is open in another program, then you would receive a message like this:

 

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

 

find locate locked files folders Windows process locking delete move open in another program applicaiton process

To create the above, I simply created a Microsoft Word document inside a folder called, LockTest, and while I had the file still open inside Word's editor, I attempted to move the entire folder, to which the Word document belonged.

 

Often, we would know right away who the culprit is...we would know exactly which open program or active process could be using the file...but there comes times when we are completely taken dazzled by the fact. This happened to me today again...as I tried to simply move a 'jokes' folder under 'My Documents' under 'Entertainment' folder...to my dismay...I received the above error...hmm...I had not even used the 'Jokes' folder recently...and there were no open applications on my taskbar..so that was truly strange.

 

There are various ways to locate locking processes in Windows. I would recommend you the one I use, which is provided as part of the official Windows Sysinternals website and is 100% Not a risky tool or malware, it's a small file you could download quickly, it is Free, and best of all IT WORKS! It is called Process Explorer.

 

find locate locked files folders Windows process locking delete move open in another program applicaiton process

The url for download is
 
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

 

find locate locked files folders Windows process locking delete move open in another program applicaiton process

To find the locking process:
 
1) Launch Process Explorer by double clicking on procexp.exe file (shown above)
 
2) Go to Find-->Find Handle or DLL
 
3) In the "Handle or DLL substring:" box, type the full path to the file (e.g. "c:\temp\testsss\a\locktest") and click "Search".
 
4) All processes using a handle to that file will be listed.
 
5) Make a decision on what to do with the locking application. This decision could vary on a case by case basis.

 

find locate locked files folders Windows process locking delete move open in another program applicaiton process

By the way, the real culprit in my case was an image manipulation software that albeit not being visible in my task manager...was still running in the memory...and I ended up killing its process easily through Task Manager.

 

 

 

Written by Ramin Haghighat