-- emptytrashX 0.1Then just double-click to use root power to empty all your trashes.
-- 2002 devils@pobox.com
-- set your admin password inside the quotes
set swordfish to "xxxxxxxx"
display dialog "Empty Trash as root?" buttons ¬
{"Cancel", "TRASH"} default button "TRASH" with icon note
set the user_choice to the button returned of the result
if the user_choice is "Trash" then
display dialog "ARE YOU SURE?" buttons {"NO", "YES"} ¬
default button "NO" with icon note
set the user_choice to the button returned of the result
end if
if the user_choice is "Yes" then
do shell script "sudo rm -rf /.Trashes/*" password swordfish ¬
with administrator privileges
do shell script "sudo rm -rf ~/.Trashes/*" password swordfish with ¬
administrator privileges
do shell script "sudo rm -rf ~/.Trash/*" password swordfish ¬
with administrator privileges
--do shell script "sudo rm -rf /Volumes/*/.Trashes/*" password ¬
swordfish with administrator privileges
end if
[Editor's note: I haven't tried this yet, but the actual "sudo" commands as listed are what I use at the command line to force a trash can to empty. Also note that having an AppleScript lying around with your admin password in it could be considered something of a security hole -- a quick drag and drop onto Script Editor, and your admin password is revealed. Perhaps a modification to the script to request the password prior to proceeding instead?]

