Toggle Menu

Insights > Digital Service Delivery > How Do I Find Out What Process Has A File Or Folder Locked?

How Do I Find Out What Process Has A File Or Folder Locked?

I hate getting ‘Access Denied’ to a particular file or folder without explanation! As a developer, this happens to me regularly enough to be a pain, but not enough for me to actually have a good tool at my disposal for it. Well, not until now. Recently I finally was forced to find a good […]

By

April 05, 2013

I hate getting ‘Access Denied’ to a particular file or folder without explanation! As a developer, this happens to me regularly enough to be a pain, but not enough for me to actually have a good tool at my disposal for it.

Well, not until now.

Recently I finally was forced to find a good tool because something mysterious had my build folder locked, and we could not deploy our software anymore until it was fixed.  Rebooting the server would definitely work, but the problem would just creep in again, so I had to get to the source of the problem.

The key step was knowing what process was using the folder, as I couldn’t see anything logically or visibly that had it open. I have used Process Explorer in the past for this type of problem (and it’s great), but as far as I know you have to drill in or search by the process/handle, not the file or folder in question. In this case, and many other cases, I still didn’t know what had the folder locked.

A little searching yielded Handle.exe. Handle, like Process Explorer, is also a tool in the impressive Sysinternals suite. It is an extremely lightweight tool for doing exactly what I needed – give it a folder or file, and it lists what processes have it open.

Problem solved.

I have used unlocker programs in the past that will actually unlock the file or folder, but in my experience they didn’t always work and didn’t always tell you what actually was using the item. You really need this information to actually solve the problem as opposed to band-aiding it. Handle is also great because you can just copy the file onto any server or machine you want and run it. No worrying about installing something.

Thanks again, Sysinternals. I welcome this new tool permanently in my development or server maintenance toolkit.

You Might Also Like

Tech Tips

Top Four Highlights from .Net Core 2.1

.Net Core 2.1 was announced recently by Microsoft along with corresponding updates for ASP.Net Core...

Tech Tips

NancyFX Vs. Web API in ASP.Net Core

In my previous post, I gave an overview of NancyFX, an open source and community...

Tech Tips

Getting Started NancyFX and ASP.Net Core

Many people will start a new ASP.Net Core project and choose Web API as their...