Norbert Hartl

mostly brackets and pipes

Tidy Up Your Downloads Folder

Downloading stuff from the internet is just something I do every day. On Mac OS it is also quite natural that the files are put into the Downloads folder in your home folder which you can access through the application bar. The newest files are seen at first which makes accessing them really easy. Most of the time I open the files only once and then I forget them.

This works good as long as your disk space is not running short and you are not trying to find an important file you’ve downloaded a week ago but can’t remember the name. Opening the Downloads folder shows you the whole mess. Finding a file is not quite easy in those thousands and thousands of files. While it is hard to find things it is even harder to delete stuff. The files in there might be two seconds old or 1 year. I don’t want to delete really new files because I might need them the other day. I always struggle to tidy up properly. It is really cumbersome and most of the time it gets on my nerves. Then I delete all files in the folder hoping not to loose important stuff.

After all solving the problem was really easy. Files that are really important are saved immediately to the folder they belong to. Files that are rather new should stay in the Downloads folder they belong there. In between are all the candidates for removal. It just needs a rule of what is not new and not important. I think a file that I’ve downloaded and that I didn’t touch within the last three month is not that important. A one liner of shell script makes the rule come true. If you open a terminal on your Mac you just need to paste the next line in the terminal and press enter:

find ~/Downloads -atime +90d -exec mv {} ~/.Trash \;

It finds all files in the Downloads folder that have not been accessed within the last 90 days. Every file that was last touched more than 90 days ago is moved into the trash. In the trash you can let reside them for another period. Or you do quick scan over the files to find files that shouldn’t be deleted. Or you you just empty the trash making room for more removals