Unable to ‘Empty Trash’ problem (i.e. How to delete locked files in OS X)

Recently I encountered this problem when trying to empty my Trash folder — the process kept being interrupted by an error message: “The operation cannot be completed because the item “wmphelp.htm” is locked”.

I hit the Continue button and there were similar messages: “WMPIcon.gif” is locked… “windowshade.gif” is locked…

Here’s a sample screenshot (from Otterman):
The image “http://myskitch.com/sivasothi/empty_trash_cannot_complete-20071202-135711.jpg” cannot be displayed, because it contains errors.

Clearly the problem were with files related to Windows Media Player I deleted earlier. I had about 300 over files in the Trash folder so I needed to find a solution quickly.

I emailed the folks in the me@n list (thanks folks!). Their suggestions included:

  1. Repairing the file permissions with Disk Utility before attempting the Empty Trash operation.
  2. Manually checking the offending file to ensure that I had Read/ Write permission
  3. Press Option + Empty Trash

Tried suggestion #1 (even booting from a startup disk and running Disk Utility from the CD) but still had the error message.

Tried suggestion #2 but problem was those specific file names weren’t in the Trash folder.

Suggestion #3 didn’t work either.

In the end, Siva aka Otterman provided the solution. He suggested “Cmd +Option + Shift + ‘Empty Trash’”.

It worked beautifully!

Even scared me a little ‘cos there was no prompt to confirm the Empty Trash operation. Hit those combinations and it cleaned out everything in the Trash folder immediately.

I’m still not quite sure why the offending file couldn’t be deleted (even though I had permission to delete it). But at least now I’ve picked up this neat trick with the keyboard shortcut.

Siva has more details about deleting locked files in OS X at this post. Excerpt:

In Finder:

  • cmd-delete = move selected item to trash
  • cmd-shift-delete = empty trash (with warning prompt; locked files not deleted)
  • cmd-option-shift-delete = empties trash without dialog, included locked files

19 Responses to “Unable to ‘Empty Trash’ problem (i.e. How to delete locked files in OS X)”

  1. Partners in Grime Says:

    Can also control-click the trash icon to empty it.

  2. trademark registration Says:

    I had been looking for an answer to this problem. Thank you.

  3. Nick Says:

    It’s somewhat amusing that many Mac users seem to think that “repair permissions” is a suitable response to any and every problem a user may have on OS X. It’s the uncomprehending - but eager to give advice - Mac user’s equivalent to a witch doctor’s rain dance.

    In Leopard, Apple has actually put a note on Disk Utility explaining what they’ve put the function there for. Unfortunately, that won’t stop people thinking it’s a magical cure for anything and everything.

    Anyway, I’d have looked at Apple’s support documents under “can’t empty trash”. Here’s the document:

    http://docs.info.apple.com/article.html?artnum=106272

    You’ll see it does reference another Apple document called “Troubleshooting permissions issues in Mac OS X”. BUT it specifically references the section in that page called “Emptying the Trash”, which discusses the way permissions on that file may relate to the problem rather than advising the customer to run Disk Utility on the volume and forlornly hope.

    The problem can get quite tricky, and even Apple’s tips there may not solve it, since there could even be immutable flags set on the file.

    Anyway, glad you resolved the problem, but I’d suggest with most problems Apple’s Support site is the very first place to look.

  4. health Says:

    Stumbled upon your blog a week ago and decided to come back. Not for the articles you write, but for how you write them, really amazing stuff you’re doing here, i like how you put information into the articles which makes it much more easier to read and much more interesting of course. Keep up the good work!

  5. Howard Says:

    THANK you for this !!! i have been trying to clear out my external USB crives after changing over from PC to Mac and they were littered with thousands of locked files which I was going through one by one… jeeez

    Now - one click and they are GONE !!! :D

  6. baha Says:

    sweet

  7. Hannah Says:

    That still didn’t do it for me… I’m having the exact same problem.

  8. Jon Says:

    Yeah same here, has not fixed it at all. Got really built up with hope then dropped like my old PC. Oh well there will be a solution somewhere.

    Cheers

  9. Laya Says:

    Wow it worked thanks!!!

  10. A1phaGeek Says:

    I too am having this issues. It is with windows files from my Boot Camp partition. It was a Fat32 Partition, that I needed to erase and reinstall. Now the reinstall went well, but nothing I have tried, including terminal removal and permission repair tools.

    Any ideas?

  11. Gogo Says:

    This article suggested is really good:

    http://docs.info.apple.com/article.html?artnum=106272

    I followed this section: “Advanced tip about deleting locked files” and everything was deleted from my Trash!

    Thanx Nick!

  12. A1phaGeek Says:

    I solved my issue, but I thought I would leave info for those with the same issue.

    Mine was that Mac can’t trash items on a windows FAT32 drive. When I was trying the Terminal batch remove or change properties method (found in the links of the post above), I noticed that the files were located in a hidden “.Trashes” file on the root of my Boot Camp partition. So I went to the windows Control Panel, then to Files. Then I choose the Show Hidden check box. After that the .Trashes folder was visible on the root level of the windows (boot camp) C drive. I just had to move the folder to the Recycle bin and empty it.

    Viola, when I booted back to OSX, the trash was finally EMPTY!!!

    Hope this helps,
    A1phaGeek

  13. Garapati Says:

    Worked well Thanks

  14. Confuseling Says:

    Cmd option shift didn’t work for me, but Partners in Grime is my new hero.

    Moved the mouse over the dock, held control, clicked the trash can, and was presented with a ‘empty trash’ menu option which worked.

    No more dragging media player out of the trash to empty it for me! Thanks!

  15. Snomad Says:

    remember not to select ‘empty trash’ but hit the actual delete key with the command + option + shift keys. Great to hear that trash sound! I had been trying to get rid of locked files for months without success!

  16. mondo Says:

    that was pure magic,I too was scared a bit as it was too fast

  17. Meredith Says:

    I’m having a similar problem. When I try to empty my trash, Mac OS X unexpectedly quits. The gray curtain comes down and I have to restart.

    I’ve sent the report to Apple and am waiting for a response. Not sure they will get back to me.
    I tried the suggestions above - none worked.
    I’m at my wit’s end.

    I do know there is a “bad” .mov file in the trash (which I can’t see… it’s invisible!!) and there is another file in the trash that has had problems in the past - which one, I don’t know. I have over 40GB in the trash that needs to be dumped.

    ANY SUGGESTIONS???
    Thank you!

  18. Meredith Says:

    Wait… I missed these last couple suggestions (above). I am going to try those….

  19. Meredith Says:

    NOPE.. That didn’t work. I fear I will have to erase the entire drive and start from scratch….

    help!

Leave a Reply