Is there any way I can create an automator service or app to delete ALL trash from any USB drive (my own account's trash plus everybody else's)?

I've read several solutions involving Terminal, including this one, but I'd like something a bit more foolproof and really handy.

I need to exchange USB drives regularly for presentations at events and Mac trash is becoming a problem as Macs become more common -- people suddenly get "no space available" error messages and can't do anything about it. I know how to skip the trash, but need a quick fix when the trash is already there.

  • 1
    Whats wrong with emptying the Trash in the regular way?
    – Thecafremo
    Apr 18, 2013 at 11:17
  • like bin/bash+Trash and its gone :)
    – Ruskes
    Apr 18, 2013 at 11:22

2 Answers 2


2 Solutions. 1 using Bash the other using Bash wrapped in AppleScript.

Solution #1

  1. Create a new AppleScript with /Applications/Utilities/AppleScript Editor
  2. Type the following code:

    do shell script "rm -rf /Volumes/*/.Trashes/*" with administrator privileges
  3. Save the file to somewhere convenient and run it whenever you need to clear the USB Trash
  4. This can be executed by double-clicking on it

NOTE: This will empty the Trash for all connected volumes including your internal hard disk. If you have connected 5 USB drives and a Firewire hard disk, it will empty the trash for all of them.

Solution #2

  1. Fire up your favourite text editor (mine is nano)
  2. Paste the following code into your text editor and save the file

    sudo rm -rf /Volumes/*/.Trashes/*
  3. Save the file to somewhere convenient with the extension .sh and then make it executable with chmod +x {filename}.sh from Terminal
  4. Run that with ./{filename}.sh

NOTE: Same note as above. This is executable from Terminal.

  • 1
    Why do you escape the *s?
    – nohillside
    Sep 28, 2013 at 14:47
  • 1
    I fixed it up. It was because before I was editing in a different visual editor, and needed the escape character on them or it bolded the text or something stupid in between. Sep 28, 2013 at 14:49

Using Automator :

  • Create a new Service with automator
  • Change Service receives selected to files and folders
  • Change pass input to “as arguments” from “stdin”
  • Add a Run ShellScript action

Use this script

find /Volumes/ -maxdepth 2 -mindepth 2 | grep .Trashes | xargs rm -R
  • Save your new service

It will be accessible from the right clic under the name you saved it.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .