Cannot empty Trash (file on external hard drive)

kolax

macrumors G3
Original poster
Mar 20, 2007
9,181
115
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?!
 

mason.kramer

macrumors 6502
Apr 16, 2007
270
11
Watertown, MA
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!
 

kolax

macrumors G3
Original poster
Mar 20, 2007
9,181
115
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.
 

mason.kramer

macrumors 6502
Apr 16, 2007
270
11
Watertown, MA
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/


 

kolax

macrumors G3
Original poster
Mar 20, 2007
9,181
115
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
 

mason.kramer

macrumors 6502
Apr 16, 2007
270
11
Watertown, MA
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.
 

mason.kramer

macrumors 6502
Apr 16, 2007
270
11
Watertown, MA
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
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).
 

kolax

macrumors G3
Original poster
Mar 20, 2007
9,181
115
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.
 

kolax

macrumors G3
Original poster
Mar 20, 2007
9,181
115
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).
When I delete something, it displays this:



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

kolax

macrumors G3
Original poster
Mar 20, 2007
9,181
115
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!
 

mjones185

macrumors regular
Jan 18, 2009
101
0
Warner Robins,GA
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.


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
 

scmac85

macrumors newbie
Nov 27, 2008
9
0
Charleston, SC
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
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.
 

ptjh

macrumors regular
Mar 14, 2008
136
0
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
 

kolax

macrumors G3
Original poster
Mar 20, 2007
9,181
115
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
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.
 

nsbio

macrumors 6502a
Aug 8, 2006
634
0
NC
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...
 

ptjh

macrumors regular
Mar 14, 2008
136
0
It costs money to empty your trash with compost. I didn't know greenhouse gasses worked in that way!
 

nsbio

macrumors 6502a
Aug 8, 2006
634
0
NC
It costs money to empty your trash with compost. I didn't know greenhouse gasses worked in that way!
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.
 

jameskachan

macrumors member
Aug 16, 2008
55
12
Toronto, Canada
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
 

Stubaan

macrumors newbie
Sep 10, 2008
19
0
Gainesville, FL
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?
 

GGJstudios

macrumors Westmere
May 16, 2008
44,419
768
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?
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
 

Stubaan

macrumors newbie
Sep 10, 2008
19
0
Gainesville, FL
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!
 

GGJstudios

macrumors Westmere
May 16, 2008
44,419
768
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!
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.
 

bamizele

macrumors newbie
Dec 16, 2010
1
0
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. :)
 

Atsmiller

macrumors newbie
Nov 1, 2010
6
0
Estonia
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).
 

Similar threads

Register on MacRumors! This sidebar will go away, and you'll see fewer ads.