Cannot empty Trash (file on external hard drive)

Discussion in 'macOS' started by kolax, Nov 9, 2008.

  1. kolax macrumors G3

    Joined:
    Mar 20, 2007
    #1
    Problem: I have a folder which I deleted from my external hard drive. Whenever I empty Trash, I get the insufficient privileges error. The folder is empty.

    I've tried emptying the trash, securely emptying the trash and used these Unix commands in Terminal too:


    rm -rf .Trashes
    rm -rf [directory]
    sudo rm -rf [directory]
    rmdir [directory]



    And all these return 'Operation not Permitted'. The file is actually in the Trash and only appears when I plug in my external hard drive. I get the 'Insufficient Privileges' error when I empty trash from the Finder.

    How do I get rid of this bloody folder?!
     
  2. mason.kramer macrumors 6502

    mason.kramer

    Joined:
    Apr 16, 2007
    Location:
    Watertown, MA
    #2
    The file only appears in your Dock's trash when you plug in the drive. This indicates that the file you want to delete is not residing in /.Trashes/. Rather, it is residing in /Volumes/ExternalVolume/.Trashes/, where "ExternalVolume" is the name of your external volume. When Mac OS sends a file to the trash, it does so on the local volume. When Mac OS mounts a volume that has a .Trashes in the top directory, it merges the trash there with the trash in /.Trashes/ and displays it as one file in on the Dock. But really, the files that comprise the Dock's trash are located in disparate locations.

    Try this command in terminal.

    ls -a /Volumes/ExternalVolume/ | grep Trash

    This will display all the files in external volume with "Trash" in them. If you have a .Trashes there, ls that
    ls -a /Volumes/ExternalVolume/.Trashes
    look for your problem folder there.

    If it's there, hit it, or the .Trashes folder that encloses it, with sudo rm -rfv.

    No file can survive a sudo rm. The reason your command isn't working is because you're not targetting the right place. Happy hunting!
     
  3. kolax thread starter macrumors G3

    Joined:
    Mar 20, 2007
    #3
    This is the response I got:


    RMBP:~ Ross$ ls -a /Volumes/MEDIA\ HD2/ | grep Trash
    .Trashes
    ._.Trashes
    RMBP:~ Ross$ ls -a /Volumes/MEDIA\ HD2/.Trashes
    . .. ._501 501



    I am using the right directory, because I've dragged the folder from the Trash into the Terminal window and get the directory:

    RMBP:~ Ross$ /Volumes/MEDIA\ HD2/.Trashes/501/asd/My\ Pictures


    Thanks for reply.
     
  4. mason.kramer macrumors 6502

    mason.kramer

    Joined:
    Apr 16, 2007
    Location:
    Watertown, MA
    #4
    rm -rv /Volumes/MEDIA\ HD2/.Trashes/




    Please post the output of this command? (Note: this will permanently erase anything else in the .Trashes on that drive).

    Edit: Also do rm -rv /Volumes/MEDIA\ HD2/._.Trashes/


     
  5. kolax thread starter macrumors G3

    Joined:
    Mar 20, 2007
    #5
    The second command returned 'not a directory'. This is the result from the first command:


    RMBP:~ Ross$ rm -rv /Volumes/MEDIA\ HD2/.Trashes/
    rm: /Volumes/MEDIA HD2/.Trashes//501/asd/My Pictures: Operation not permitted
    rm: /Volumes/MEDIA HD2/.Trashes//501/asd: Directory not empty
    rm: /Volumes/MEDIA HD2/.Trashes//501: Directory not empty
    /Volumes/MEDIA HD2/.Trashes//._501
    rm: /Volumes/MEDIA HD2/.Trashes/: Directory not empty



    From the commands in your first post, whenever I delete something, I get the message: "This will be deleted immediately, are you sure you want to continue" - I'm familiar with this when deleting stuff from FTP's, but how do I revert back so everything goes to the Trash can?!

    Thanks
     
  6. mason.kramer macrumors 6502

    mason.kramer

    Joined:
    Apr 16, 2007
    Location:
    Watertown, MA
    #6
    What in the world? Now this file is getting personal. The only thing I can think of is maybe the file has the immutable flag set.

    Output please:
    Code:
    ls -lO /Volumes/MEDIA\ HD2/.Trashes/asd/My Pictures;
    ls -lOR /Volumes/MEDIA\ HD2/.Trashes/501/ | grep uchg; 
    ls -lOR /Volumes/MEDIA\ HD2/.Trashes/501/ | grep schg;
    
    If anything comes up with a uchg or schg flag, you have to unset the flag using chflags.
    Code:
    man chflags;
    chflags -R noschg /Volumes/MEDIA\ HD2/.Trashes/;
    chflags -R nouchg /Volumes/MEDIA\ HD2/.Trashes/;
    
    If it is the immutable, I have no idea what the hell would have set it. Whatever it is, it's bad. If it's an schg flag, you have to restart in single user mode (restart, hold cmd-s) and do it there. You might have to mount the filesystem before you can make these changes in single user mode. If you do, the command to mount the FS will be displayed in the single user console. Read what it says there.
     
  7. mason.kramer macrumors 6502

    mason.kramer

    Joined:
    Apr 16, 2007
    Location:
    Watertown, MA
    #7
    The likely cause of this problem is that the OS cannot create or write to the .Trashes directory on the drive. There are a few reasons why this could be. One reason would be that .Trashes is a file, not a directory. Another reason is that you don't have write privileges to .Trashes on that drive. Another reason is that .Trashes, or the file system on which it resides, is corrupted, preventing writes.

    Are you saying that, after running the commands that I listed in my first post, the functionality changed from trashing to immediate delete on that drive? Are you sure that those commands are the only change? Because they shouldn't have lead to this problem: even if you had succeeded in rm'ing .Trashes, the OS would simply recreate the directory the next time you trashed something. (But you didn't succeed).
     
  8. kolax thread starter macrumors G3

    Joined:
    Mar 20, 2007
    #8
    Thanks for your help - I decided to load up Parallel's Desktop and trashed the .Trashes folder there and problem solved!

    I'm surprised it was such a big deal to get rid of on OS X.
     
  9. kolax thread starter macrumors G3

    Joined:
    Mar 20, 2007
    #9
    When I delete something, it displays this:

    [​IMG]

    It displays it for deleting items on my Macintosh HD, not for any other HD. I'm confused!
     
  10. mason.kramer macrumors 6502

    mason.kramer

    Joined:
    Apr 16, 2007
    Location:
    Watertown, MA
    #10
    I don't know. If the file or folder is very large, Mac performs an immediate delete. Does it do that with a small file?
     
  11. kolax thread starter macrumors G3

    Joined:
    Mar 20, 2007
    #11
    Asks for any file regardless of size - I've tried Googling this, but had no luck.

    Edit: I just restarted my Mac and it no longer asks. Strange! But it's all done and dusted now, thanks for your help!
     
  12. mjones185 macrumors regular

    Joined:
    Jan 18, 2009
    Location:
    Warner Robins,GA
    #12


    Dido,

    Holy crap did I read a huge amount of info in the internet trying to fix this very same problem. Your solution was the fix. Only difference is I used VMWare Fusion.

    Mike
     
  13. scmac85 macrumors newbie

    Joined:
    Nov 27, 2008
    Location:
    Charleston, SC
    #13
    Same here. Couldn't figure out why the items in my trash wouldn't delete when my hard drive was plugged in. It got really annoying when I ran into space issues with what appeared to be an almost empty drive. Opened it up in Windows and showed hidden files. The trashes folder was almost 150GB. Now I can back up before I go turn my computer in at the Apple Store tomorrow to hopefully get fixed for another issue.
     
  14. ptjh macrumors regular

    Joined:
    Mar 14, 2008
    #14
    I have this problem. Which method worked to resolve this or what do I type. I have 2 external volumes, the one I want to target is My Book.
    Thanks
     
  15. kolax thread starter macrumors G3

    Joined:
    Mar 20, 2007
    #15
    Seems from the three people who have posted solutions to this, the only way they could resolve it was to use Windows and delete the .Trashes folder.

    Might be worth submitting a bug report to Apple if this is still an issue - could be a bug.
     
  16. nsbio macrumors 6502a

    nsbio

    Joined:
    Aug 8, 2006
    Location:
    NC
    #16
    Mac OS X Trash management has been embarrassingly poor for a number of years. This might not help you directly, but I have been using a Trash management utility called Compost...
     
  17. ptjh macrumors regular

    Joined:
    Mar 14, 2008
    #17
    It costs money to empty your trash with compost. I didn't know greenhouse gasses worked in that way!
     
  18. nsbio macrumors 6502a

    nsbio

    Joined:
    Aug 8, 2006
    Location:
    NC
    #18
    alas, this is true. :apple: should have compost functionality built into the OS, which means that it should be easily accessible through graphic interface and not only through some silly Terminal commands.
     
  19. jameskachan macrumors member

    Joined:
    Aug 16, 2008
    Location:
    Toronto, Canada
    #19
    I have some files that are NOT DELETING no matter what I do.
    I dont know UNIX or terminal that well, though enough I suppose, to be guided if anyone can help.

    Ive tried: Secure delete, holding option and deleting, a bunch of random terminal commands, booting into safe mode and trying to delete. NOTHING works.

    Im trying to remove files from a HDD connected via eSATA to my 17" MBP via the express32 slot.

    When I run this:
    Code:
    ls -lO /Volumes/2TB_BKUP_WHITE/.Trashes/501
    I get this:

    Code:
    James-Kachans-MacBook-Pro:~ james$ ls -lO /Volumes/2TB_BKUP_WHITE/.Trashes/501
    total 0
    drwxrwxrwx  4 james  staff  - 136 30 Aug 00:27 CAPTURES
    James-Kachans-MacBook-Pro:~ james$ 
    
    When I tried running this:
    Code:
    rm -rv /Volumes/2TB_BKUP_WHITE/.Trashes/501/CAPTURES
    I got this:

    Code:
    override r-xr-srwx  root/2441 sappnd,arch,opaque for /Volumes/2TB_BKUP_WHITE/.Trashes/501/CAPTURES/_MG_9722.dng? ls -lO /Volumes/2TB_BKUP_WHITE/.Trashes/501/CAPTURES
    
    I think that maybe the files are corrupted / immutable or something, However I dont really understand this stuff.

    Thanks
    James
     
  20. Stubaan macrumors newbie

    Joined:
    Sep 10, 2008
    Location:
    Gainesville, FL
    #20
    This still a problem?

    I am still having this ridiculous problem in 2010, damn near 2011.

    Has anyone figured out a solution that does not entail paying money or starting a virtual machine simply to delete some trash for real?

    Has anyone figured out the source of the problem? is it just a problem for eHDs formatted to FAT, or have people using NTFS-3G/other also encountered this arguably most irritating facet of my Mac life?

    Really? It's 2011 and we still can't delete a file from an eHD?
     
  21. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #21
    I have no problem deleting files from FAT32, NTFS (using NTFS-3G) or HFS+ drives.

    You can't empty the Trash or move a file to the Trash

    Force empty Trash
     
  22. Stubaan macrumors newbie

    Joined:
    Sep 10, 2008
    Location:
    Gainesville, FL
    #22
    Hi :)

    I want to talk about this.

    Are you deleting the files from within Finder? And have you made hidden files visible and checked the otherwise-invisible Trashes directory on your external?

    Sorry if this is obvious, but I thought I was deleting files for ages before I ever discovered that a local hidden Trashes directory was being made and storing every deletion.

    Thanks!
     
  23. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #23
    You don't need to make hidden files visible. Mac OS X creates .trashes files and other hidden files for a purpose. If you delete them, they will just get re-created. That has nothing to do with emptying the Trash.
     
  24. bamizele macrumors newbie

    Joined:
    Dec 16, 2010
    #24
    Problem fix!!!!!

    I just found how to fix this problem, I also had this same problem. all you need to do is connect it to a windows computer and do a drive scan, then when done put it back on your mac and try to empty trash. that should work it would for me.

    LOL just make an account to post that. i wish you could post suggestion with out making an account. o well hope i helped. :)
     
  25. Atsmiller macrumors newbie

    Joined:
    Nov 1, 2010
    Location:
    Estonia
    #25
    Embarrassing...

    Yes, this problem still persists. I have worked all my life with UNIX terminal, I know ’sudo rm’ by heart... nothing. In some way it’s amazing how Apple could so royally screw up here. I have some Corsair USB drives and some external HD-s. Basically, there are 2 solutions – 1)mount drive under Linux or Windows and delete .trash there; 2)If there is something you need, copy that away, start Disk Utility and erase all (and copy needed files back again).
     

Share This Page