One-click automated USB trash delete

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

    #!/bin/bash  
    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.