Deleting locked folders from Trash on OSX

I've recently had a stubborn folder in my Trash which I haven't been able to delete for ages due to an getting the following error message.

"The operation could not be completed because the item '{folder name here}' is locked."

After a little digging on the Apple site I've found this (and it's now here for my future reference too)

  1. Open Terminal (/Applications/Utilities).
  2. Type this, followed by a space: sudo chflags -R nouchg
  3. Drag the folder you would like to unlock into the Terminal window.
  4. Press Return.
  5. Enter your password and press Return.

For further info check out http://docs.info.apple.com/article.html?artnum=106237

Posted: 05-Dec-2007

View: 7703

Permalink: here

Comments

I believe holding down the option key when you empty trash does the same thing.

#1 ryan
05/Dec/07 10:14 AM

Normally holding the Option key down works with locked folders, but I have had a stubborn folder in the trash on a USB thumb drive. Whenever I plug it in, the trash shows this item and holding down Option does not work when emptying the trash. I will have to try this.

#2 Lance
05/Dec/07 11:04 AM

@ryan I tried that, even CHMOD/CHOWN from the terminal but nothing was removing the lock

#3 Andy Jarrett
05/Dec/07 11:05 AM

I have to ask....
Did you try right/cmd clicking the item and select "Get Info", then uncheck the "locked" chekbox?

#4 Bash
05/Dec/07 4:51 PM

@Bash: That's fine for one or two files. But when you're trying to delete 200 files scattered around in deeply nested folders . . . well, you're going to get a very sore finger after all those clicking.

#5 Lola LB
06/Dec/07 3:54 AM

@Lola
I could see that being true. I don't let my trash build up that long.

#6 Bash
07/Dec/07 10:28 AM

But do you know how to remove those invisible .trash folders Mac computers create?

#7 Carolina
16/Dec/07 6:56 PM

The command line you suggest (and thanks for that) isn't working. The folder that i want to remove from trash was deleted from an USB HDD i dont find a way to unlock it!! No option key, no command line whatsoever... Help!!!

#8 Antonio
07/Jan/08 2:35 PM

Try holding CTRL/ALT/CMD (apple key)
and empty trash ;-)

#9 mitch
01/Feb/08 11:38 AM

Thanks -- this post helped me out quite a bit today. I was having trouble removing some folders connected to a subversion repository. The locked subversion files were causing the same error blocking my deletes.

#10 Dave
22/Feb/08 10:27 AM