Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to empty the Trash only on an external drive?

Is there a simple way to empty the Trash on an external drive without touching your Mac hard drive's Trash?


I often want to clean up Thumb drives and other external drives to make space on them, but don't want to empty the trash on my Hard Drive. I have searched but cannot find a simple way to do this i.e. without just trying to remove the .trash directory on the external drive by using Terminal comands, or viewing hidden files, or putting the drive into a PC to do it. Any ideas?

MacBook Pro, Mac OS X (10.7.2)

Posted on Jul 30, 2012 1:28 AM

Reply
11 replies

Jul 30, 2012 7:54 PM in response to baltwo

Whilest the X Lab article is a useful one about OSX Trash functionality, it doesn't provide an answer to my question.


It leads to to believe there isn't a simple answer to do it quickly. Can anyone advise a simple Automator function to do this when I eject an external drive?


There's a paid add-on here:

http://www.hyperbolicsoftware.com/SmartTrash.html

Jul 31, 2012 5:22 AM in response to iorganutan

Hi,


I use this script AppleScript, save it as Application :


onopenthese_volumes

sett_idtouser IDof (system info)

repeatwithiinthese_volumes

if (kind of (info for i without size)) is "Volume" then

set tPath to (POSIX path of i) & ".Trashes/" & t_id

do shell script "/bin/rm -Rf " & (quoted form of tPath) & "/*"

end if

endrepeat

endopen

----------------------------------------------

Drag/Drop Volume(s) on the application.


This script removes the items from your trash (user ID) folder on the volume.

if other users use the volume this script will not delete the items from their trash folder, otherwise the script would need an administrator password to do that.



----------------------------------------------

If you want to eject the volume after emptying the trash, use this script.


onopenthese_volumes

sett_idtouser IDof (system info)

setvolToEjectto {}

repeatwithiinthese_volumes

if (kind of (info for i without size)) is "Volume" then

set tPath to (POSIX path of i) & ".Trashes/" & t_id

do shell script "/bin/rm -Rf " & (quoted form of tPath) & "/*"

set end of volToEject to contents of i

end if

endrepeat

if volToEject is not {} then tell application "Finder" to eject volToEject

endopen

Oct 3, 2013 2:05 PM in response to iorganutan

I found a way to delete some files that were locked in an external drive's .Trash folder. I tried EVERYTHING, all sorts of "-f" and "-rf" attached to "rm" command, chmod, everything. Looked at so many web pages. In the end this is what worked and it's SIMPLE. No script needed, iow. You need to use the Terminal initially to get them somewhere where you can use "Get Info" to uncheck that "Locked" box:


1. Setting the scene: Evil files lived several subdirectories down into ".Trashes" folder in a thumb drive.

2. Open Terminal application

3. $ cd /Volume

4. $ ls [You'll now see a list of Volumes and one will be the name of your thumb drive. Call it "MESS"

5. $ cd MESS

6. $ ls -a [now you'll see the hidden files in MESS, like .Trashes or .Trash

7. $ cd .Trashes/502/one-directory/two-directory/three-directory [use your own directory path names of course, to get to your own evil files]

8. Here's where the two evil files are that won't go away, call them evil.doh and evil2.doh

9. $ mv *.doh ..

10. $ cd ..

11. $ ls [now I see they have moved up a directory]

12. repeat step 9 until you've got them OUT of .Trashes

13. Now look at them through Finder cuz now they're visible there. Control-click on them and 'Get Info". Uncheck "LOCK"

14. DELETE

15. You might have to cd back into .Trashes and delete them there too, but at least they'll delete now!

How to empty the Trash only on an external drive?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.