Permanently deleting trashed files after 30 days

Gmail has a nice feature that permanently deletes e-mails after they've been in the Trash folder for 30 days. This is pretty clever, because if I don't need a trashed message back after 30 days it's very likely that I won't ever need it again.

I want to do the same for my Trash folder in OS X to make the best use of my disk space. Is there an easy way to automatically delete trashed files after 30 days?

Meta note: I don't think this is a duplicate of another thread because there the trigger is "disk space drops below X GB" and the effect is "the entire Trash folder is emptied". I only want to autodelete files older than 30 days.


Solution 1:

This can be accomplished natively in macOS Sierra. Go into the Finder’s preferences, and on the “Advanced” tab pick “Remove items from the Trash after 30 days”.

Finder Advanced Prefrences

Solution 2:

As mentioned in the linked thread, Hazel is a good option for this if you don't want to roll your own.

Specifically, it offers the option to delete those files that only have been left in the Trash greater than the time you've specified:

Hazel