MacMost Q&A Forum • View All Forum QuestionsAsk a Question

Empty Trash Action in Automator?

There doesn’t seem to be an Automator action for Emptying Trash. Is there a way to execute this action through other actions? Also, thought the macmost podcast on Automator is helpful, is there any site which really exhaustively deals with automator and why it’s so tricky to handle? No offense, but since the new updates with Services instead of plug-ins etc., the older articles don’t seem comprehensive enough.

— Saianka

Comments: 5 Responses to “Empty Trash Action in Automator?”

    14 years ago

    Remember that you can run any AppleScript in Automator. So for going deeper than the Automator pre-defined actions, just use the "Run AppleScript" action. For emptying trash, for instance, you can use Run AppleScript with:

    on run {}
    tell application "Finder"
    empty the trash
    end tell
    end run

    Automator and AppleScript is a very deep subject. I could do 500 videos on that subject alone. So finding a balance is tough. I plan to continue to do Automator videos in the future, but I can't do that many of them as a majority of people learning the Mac/iPhone/iPad are not focused on that one single subject.
    As for more tutorials -- just search the Internet. Tons of things come up at various different sites.

      Jim Edwards
      12 years ago

      Doing this without conditions is very dangerous. Rather than setting the finder to automatically empty the trash when anything is put in it, I have attached it to a specific action that occurs daily on our OS X Server, that way I can through something in the Trash without worry of it getting deleted immediately.

    Jim Marshall
    12 years ago

    As of Lion, this one line is sufficient:

    tell application "Finder" to empty trash

    David
    12 years ago

    on run {}
    tell application “Finder”
    empty the trash
    end tell
    end run
    that brings up syntax error
    Expected expression, property or key form, etc. but found unknown token.

    David
    12 years ago

    sorry it works if you don't copy and paste :-)

Comments Closed.