Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sometimes emptying the trash in Finder takes significantly longer than just running rm -rf ~/.Trash. Is there some way to remap the "right click on trash in dock + click to empty trash" button to a script?

share|improve this question
    
Welcome to AskDifferent! This site works better if there is just one question in a post. I've edited your question accordingly, feel free to ask additional questions separately. –  patrix Apr 29 '13 at 4:46
2  
Understood, I'll submit the query about the "whys" of the issue separately. –  Kaya Apr 29 '13 at 5:32
add comment

1 Answer

up vote 1 down vote accepted

It would be easier to use an alias like this:

alias et="(shopt -s nullglob; find ~/.Trash /Volumes/*/.Trashes/501 -mindepth 1 -delete)"

rm -rf ~/.Trash/* doesn't work if the list of filenames is longer than getconf ARG_MAX, and it doesn't include files that start with a period. Deleting files in trash folders often requires root permissions though.

tell app "finder" to empty and trash -e (see hasseg.org/trash) can be run silently or on the background, but they are just as slow as emptying the trash from the GUI, and they make Finder display error dialogs if for example files are in use.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.