Automatically delete files from Trash that have been in Trash for 14 days or more

I know that macOS (Sonoma, in my case) can be set to automatically remove files that have been in it for 30 days, but is there a way of setting that cut off at 14 days instead of 30?


Alternatively, is there a way of automating a process that can remove files at 14 days of being in the Trash rather than 30?

MacBook Pro 14″, macOS 14.0

Posted on Oct 26, 2023 3:22 PM

Reply
3 replies

Oct 26, 2023 4:11 PM in response to gjt1234

There are various discussions of scripts created specifically for customized deletion intervals.


Here is one from a while back:

https://discussions.apple.com/thread/3172966?answerId=15611444022#15611444022


That script uses srm, I’d likely swap thst usage for rm given endemic use of SSDs.


Here’s another example:

https://www.igorkromin.net/index.php/2020/10/28/how-to-easily-set-up-your-mac-to-empty-the-trash-at-timed-intervals/


I’ve used periodic for these and other tasks, here running a job daily and deleting older than a week.

https://www.alansiu.net/2020/08/26/running-daily-weekly-and-monthly-scripts-in-macos-using-periodic/


Hazel, mentioned above, is another option.



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Automatically delete files from Trash that have been in Trash for 14 days or more

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.