How to Automate Cleaning up Your Trash and Downloads Directory
Set a cleanup schedule on macOS with a single line of code
Introduction
How many files do you have in your Downloads directory? Find it out with this command on your terminal:
ls ~/Downloads | wc -l
How about your Trash directory?
ls ~/.Trash | wc -l
Now let’s find out how many files are older than 7 days in your Downloads and Trash directory.
find ~/Downloads -mtime +7 | wc -l | xargs
find ~/.Trash -mtime +7 | wc -l | xargs
Do you have a lot of files? If you haven’t used them for a long time, you won’t need them. Let’s clean it up.
Cleanit makes it easy to clean up these directories depending on the date when files were created. You can also schedule cleaning up your Downloads and Trash directory on macOS.
I have introduced Cleanit before. The new version can set a cronjob and you can install it using Homebrew.
Are you interested? Read on!
Installation
Homebrew
brew tap shinokada/cleanit && brew install cleanit