Let my folder go!

Recycle Bin

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.

Windows tech tip of the week #1

Open File dialog box

Hi.

It’s been a long time since I posted. Sorry about that  😉

It took me a while to figure out what I want to write here in my blog. I started the blog thinking I’d write about technical stuff. Maybe software development, or game design. It was right after I stopped working on Swat and I had the burning feeling that I needed to help the world by warning it about the dangers of using ActionScript. I wanted to tell the world about it’s rounding bug when changing an object’s alpha property. I wanted to rant about how animations started playing just because I had the audacity to pre-load them. And how I got around it by muting the speaker. I was young and infused with a sense of mission. But, alas, my passion faded away. At first it was simply too painful, the wounds still fresh. I always found excuses not to do it. After some time I was thinking: there are some good solutions out there, though few and scattered. Shall I point them out? Fill out the blog a little with a few good pointers? Nah… that’s not very interesting. And then, after a while, I just thought about Flash less and less, like most of the world, I presume.

So what shall I write about? Maybe some stupid hello-world-first-post-in-the-blog thingie? (No, that’s boring, right?)  I could just write about what I’m developing – about Windows Phone 8. That’s annoying enough! Maybe I’ll share my frustrating experiences with simply trying to install the damn development platform? I only laid my hands on it and already had several new warnings to share with the world. Should I start my blog with a good, long rant? I do love to rant.

Nay. I’ll have enough time for that later! Here’s a useful little tip instead.

Windows tech tip of the week #1: If you’re using Windows, this might help you save some time whenever you need to attach a file.

Know that annoying “open file” dialog box? Well, it’s annoying if you’ve already got the directory open in front of your eyes. You can see the file, but you can’t simply drag and drop it, now can you? What you can do is copy the file (ctrl+c) and then in the dialog box in the file name field paste it (ctrl+v). It will paste the file *name*, complete with the path. Hit OK and get back to your life.

You can also copy the file path by holding down the Shift key and right-clicking the file. The Shift key miraculously add the “Copy as path” option to the pop-up menu.

Oh, and speaking of Windows 8, don’t install it on your laptop just yet if you’re a keyboard man like me.

peace out