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

Is It Possible To Have Shortcuts Automatically Empty Trash?

Im trying to use shortcuts to clean up my mac by closing programs and cleaning up folders and for the most part have got it to accomplish what I need, but what I’m really having trouble getting it to do is automatically empty my trash. Is there a way to have it empty your trash?

I do a lot of work that frequently has lot of files in my downloads folder and a lot of work apps that are always running. At the end of my day I like to run a shortcut and it will close all my open work programs, delete my downloads etc. Im trying to have it also empty my trash as part of this shortcut.
—–
Matthew Ogilvie

Comments: 3 Responses to “Is It Possible To Have Shortcuts Automatically Empty Trash?”

    1 year ago

    You can do this using scripting. So add the Shortcuts action "Run JavaScript for Mac Automation." Then use this code in that action:

    function run(input, parameters) {
    	Application("Finder").trash.empty();
    }
    
    Douglas Brace
    1 year ago

    In the “Trash”, using a shortcut along with the “Date Modified” and “Date Added” (which I believe I enabled because it does not normally appear) columns, is there a way to delete items older than a certain number of days? I know that it is possible to use the “Remove items from the Trash after 30 days” option in “Finder Preferences” but 30 days is longer than I would like.

    1 year ago

    Douglas: No, there' no easy way to do that. If you'd rather delete things sooner, just Empty Trash at the end of each week or day or something.

Comments Closed.