Become a MacRumors Supporter for $25/year with no ads, private forums, and more!

Force emptying trash inc external HDD with locked files

iTweed

macrumors newbie
Original poster
May 27, 2013
6
0
Hi

I have a 1TB external HDD. I moved 2 years' worth of backups to trash, and trash takes too long to load files to delete them.

So I researched and used this command: "sudo rm -rf ~/.Trash/*" and entered my password.

It came back "illegal operation"

So I figured maybe there are locked files in there.

I researched and used the unlock command chflags -R nouchg [dir_to_unlock].

Tested successfully on a test folder on the desktop.

I want to try it on the external HDD, possibly all files, but - and this is n00b - I can't figure out what my external HDD's address is in Finder. I typed the name of it and nothing.

Help?
 

JohnDS

macrumors 65816
Oct 25, 2015
1,183
248
Just open terminal and drag the icon of your external drive from Finder into the terminal window. It will automatically create the path.
 
Comment

s0nicpr0s

macrumors regular
Sep 1, 2010
230
47
Illinois
I'd recommend verifying that there is nothing left in the trash that you may have accidentally included. But if you want to force empty all trash bins you can use this command.

sudo rm -rf ~/.Trash/* /Volumes/*/.Trashes

This will first empty your local trash, and then go through and empty the trashes on all other attached drives.
 
Comment

steve23094

macrumors 68030
Apr 23, 2013
2,742
1,519
So I have tried all the suggestions here and just cannot get rid of a folder in my Trash. I have no idea why it has ended up with all these embedded folders, it must be some sort of glitch. When I try the terminal commands I get 'file name is too long'. Anybody got another idea?

Screen Shot 2016-10-28 at 02.05.52.png
 
Comment

Weaselboy

Moderator
Staff member
Jan 23, 2005
30,844
10,619
California
So I have tried all the suggestions here and just cannot get rid of a folder in my Trash. I have no idea why it has ended up with all these embedded folders, it must be some sort of glitch. When I try the terminal commands I get 'file name is too long'. Anybody got another idea?

See that little cloud to the right of some of the files at the bottom? I think that is from having iCloud Drive's Documents and Desktop sync on and I wonder if that is holding things up. Try going into iCloud settings and turning that off then empty trash.
 
  • Like
Reactions: steve23094
Comment

JohnDS

macrumors 65816
Oct 25, 2015
1,183
248
Open Disk Utility and run Repair Disk on your external drive. Run it twice, once while clicked on the line with the name of the brand of the hard drive, and once click on the line below with the name of the external hard drive.
 
Comment

steve23094

macrumors 68030
Apr 23, 2013
2,742
1,519
See that little cloud to the right of some of the files at the bottom? I think that is from having iCloud Drive's Documents and Desktop sync on and I wonder if that is holding things up. Try going into iCloud settings and turning that off then empty trash.

You were right. Logging out of iCloud seemed to take care of it.

Cheers.
 
  • Like
Reactions: Weaselboy
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.