Can’t delete from the trash?

Recently I tried to empty the trash on my Mac only to be continuously prompted with “cannot delete, file is locked”.

I found the guilty party was Windows Media Player (because the best place for that on a Mac is the trash – use VLC instead!).

It didn’t really matter what the file was, I couldn’t remove it. So here’s how I did get rid of it.

I opened the Terminal app. I then entered the hidden Trash directory in my home folder:

cd ~/.Trash

Note that I found the trash directory using two commands, the first located the directory in question, the second shows me hidden files when running ‘ls’:

locate .Trash

The dot indicates it’s hidden.

ls -ltrFa

Shows all the files (including hidden) in the current directory – quite handy as a default.

Once I’m certain where the .Trash directory is, I run the following command (in my particular case I’m getting rid of Windows Media Player):

sudo su - cd /Users/remy/.Trash/ rm -rf Windows\ Media\ Player/

After I type ‘sudo su -’ I am prompted for my password. Please be very careful with ‘rm -rf’ it recursively removes all the files in given directory without prompting for confirmation. Use it carefully, or don’t use it at all.

Now I went back the Trash in OS X, and ran ‘Empty Trash’ and it went about it’s business cleaning up the remaining files.

9 Responses to “Can’t delete from the trash?”

  1. i also had similar problem week ago .. had some files with funny names that couldnt be deleted at all .. so i boot mac into single user mode and run

    fsck_hfs -f /dev/disk0s9

    fsck forund 2 illegal file names, made adjusment and ifter reboot i was abel to delete files

  2. If you hold down the “alt” key while you empty the trash it will take care of this problem.

  3. Nice one Steve. Knew there had to be an easier way.

  4. my trash can doesn`t delete and it doesn`t say anything, it actually makes the paper sound, but it just doesn`t work, any ideas?

  5. Please help
    i have Macbook pro (MAC OS X version 10.5.7)
    i can’t empty the Trash, i try (option with empty trash in finder) and the (secure empty trash) but its not working.
    if i move the files from the Trash to desktop it showing empty.
    the files is not locked.
    Please help…..
    Regards

  6. i have same deal Amer…. :(

  7. Steve!!

    Thank you VERY much…the option button proved VERY effective and I now have an EMPTY trash! thanks again!

  8. leonardo siqueira August 11th, 2009 at 3:44 pm

    i did press the ALT key and still doesnt empty my damn trash :(

  9. please help i cant empty trash with option key and i have NO
    locked files either!!!
    its so frustrating…

Leave a Reply
Not required

CODE: Please escape code and wrap in <pre><code>, doing so will automatically syntax highlight