Let my folder go!

Your computer is yours. The files in it are yours. And you should have the right to execute them! No, not as in running them… But as in putting them to death.

But sometimes this happens:

The action can't be completed because the folder or a file in it is open in another program. Close the folder or file and try again.

Surely you wonder at this point why anyone would want to delete Shpongle. Relax, of course no one would ever want that – that’s ludicrous! But let’s say for a moment that you want to share Shpongle with a friend. And instead of emailing files directly from your music folder you decide to copy them first into a temporary folder, maybe on your desktop, then pick a few of your favs and zip them. Then you might attach the zip file from that folder to an email like I taught you and send it to spread happiness. And then you may try to delete the temporary folder – to no avail.

Why can’t I delete my own folder?

Well, technically, some app is using it. Sometimes you simply forgot to close it. But sometimes an app may erroneously keep an open handle to a folder even after it’s finished using it. (Gmail, for example, seems to have this bug where it keeps an open handle to a folder after attaching a file from it.)  Anyway, I think we can both agree that it would have been easier if the error message included the name of app.

So how do I fix this?

This would be one of these situations where it would be nice to use the Force. That might work… but today we will use Process Explorer. This little tool can easily identify which app is using your file and thus keeping the folder undeletable. It can even close the handle, freeing the file or folder without killing the app.

If you don’t have Process Explorer yet you can get it here. Notice you’ll get a ZIP file with 3 files in it. It’s what is known as a portable app – there’s no installation. Just extract the 3 files to wherever you want. Then open procexp.exe with administrator permissions (right click => Run as administrator => allow it to make changes to the computer when prompted.)

By the way, did you notice the “Windows Sysinternals” title on top of the page? Process Explorer is part of a great set of tools called Sysinternals which fulfills many fundamental duties. So fundamental that Microsoft acquired Winternals, the company that made them, back in 2006 and made the tools its own. And they’re all totally free.

To the point. Short instructions:

  1. Open Process Explorer
  2. Find the open handle to your file or folder
  3. Close the app or close the handle

I’ll explain.

Step #1: Identifying the culprit

Ok, so you’ve got Process Explorer running. And yeah, it looks kinda intimidating. That’s because this little tool is fully capable of replacing your Task Manager. What you can see here is a list of all the running processes (top section) and the list of open handles for the selected process (bottom section).

But that’s besides the point right now. Kindly ignore all that and hit the Find icon, or press Ctrl+F:

This should open a dialog box with a search field. Enter the name of the file or folder you (desperately) want to delete, or just part of it, and hit Search. After a little while you should see the results:

Process Explorer - Search Results

I guess we found the culprit.

Step #2: You could simply close the app

Ok, so now you know the name of the process, which should help you identify the app, in our example Chrome. At this point you could simply close the app and fix the problem. That would be the safest option and usually it is also the best. You could also kill the process (quite brutally) via Process Explorer. There is another option.

Or you could close the handle

Sometimes you may not want to close the bothersome app. For example if the app is your browser and you have many open pages. Instead, you can close only the handle, and that should fix the problem. But be aware that this is an aggressive act – you’d be pulling the rug from under the app, which might crash or behave unexpectedly. Still, if you believe the app is not really using the file but just hogging it, then there should be no problem.

So, how’s it done? In the results box choose the result from the list. The main window (behind) should change to reflect the selection:

The main window now shows the process (top section) and, more importantly, the specific handle (bottom section). Right click the handle and choose Close Handle. You will be warned: “Forcing a handle closed can lead to an application crash and system instability. Continue with close?”  You know what to do.

That’s it, you’re free!

And now for something completely different

A couple of alternatives to Process Explorer:

Unlocker – Supposedly provides the same service and with less clicks. According to the description it is ad supported, which could be annoying. Moreover, the app comes with an “Assistant” that runs quietly in the background. I’m not sure why.

WhoLockMe – A free tool that seems to integrate into Explorer. From what I can read it tells you who locked the file, but doesn’t provide a way to unlock it.

I haven’t tried these myself, but knock yourself out.

Tagged , , . Bookmark the permalink.

21 Responses to Let my folder go!

  1. Rajeev says:

    it’s very good information while i have one problem can you solve it as well?

  2. Absinthia Stacy says:

    Very insightful post!

  3. jaykayess says:

    Fantastic tip – thanks very much!

    On a lighter note, you can simply go through a complete Google detox – no Gmail, no Chrome (especially now that the big scary IE bug has been patched), …. and take back control of your machine from the NEW evil empire!

  4. Logia says:

    “Surely you wonder at this point why anyone would want to delete Shpongle. Relax, of course no one would ever want that – that’s ludicrous!”

    I did wonder! lol

  5. Keith says:

    I’ve stumbled upon this useful article from another webpage. It was just my luck that I did as well! I’ve been looking for a solution to this problem for ages! 😀

  6. Dan says:

    Unlocker is really great, about the ads, they are installer ads, so just read before clicking while installing and you can avoid them, also you can do a custom install to avoid the assistant which in my opinion is for dummies.

    There is 1 glitch/limitation with unlocker on windows 7, you can only right click->unlocker 1 file/folder at a time. This was not the case with windows XP but is not really a problem for 7, just something to keep in mind.

  7. Chris Laymon says:

    Hey, very cool! I never knew about this… installing…now. 😉
    On a side note, whenever I see the word “ludicrous”, SpaceBalls comes to mind. “They’ve gone PLAID!!!” But I digress.

    • Ofer Reichman says:

      yeah, I can see why you’d go there! 😀 but for some reason I was thinking about the hitchhiker’s guide to the galaxy. “utterly ludicrous” is the chance of falling onto the back of an extremely large passing bird, if you happen to be falling out of a cold and mysterious cave thirteen miles above ground level. but I guess that’s just me…

  8. Christopher Yeleighton says:

    Just use GNU/Linux instead and Tada! all your problems are gone. Stupid, stupid Micro$oft.

    • I’d agree. xD However, sadly, Microsoft made themselves so essential, it’s tough to keep converting documents because the formatting gets lost or whatever. If only we could live in a Unix-friendly world.

      Thing is, for now, it’s more of a Microsoft-run world. 🙁

      But Unix fans can dream. 🙂

  9. Thanks for sharing this! It’s pretty much common, daily problem for me, especially after uploading attachments to, say, Gmail or something. Now I know how to deal with that problem. 🙂 Thanks again!

  10. Ben yabets says:

    Unlocker saves me every time.
    I hope you didn’t deleted “Shpongle” in the end right?

  11. Dedy says:

    Very helpful, thanks for sharing. you save my day

  12. iMoses says:

    Someone should email “lsof” to Redmond.

Leave a Reply

Your email address will not be published. Required fields are marked *