Scripting Out UX Changes to the Downloads Folder

The Downloads folder is pretty much a standard feature on any modern OS. I remember my first experience with it was on Mac OSX Tiger (10.4). It became a very handy and frequently visited folder; before I was just saving all my downloads to the desktop for easy access.

Now that every browser defaults to saving files in the downloads folder(as they should), I find my downloads folder getting way to cluttered. After a few weeks, I end up with a folder filled with hundreds of files (and folders from unzipping applications), and it becomes a pain to find the file you just downloaded. Plus the folder looks very cluttered when you open it.

Being a pack-rat, I rarely delete things from my Downloads folder. I probably should, but instead I wrote a simple bash script, tied to a chron job, that will re-organize my Downloads folder and give me a fresh “empty” one each day. I call it Empty Downloads.

Basically, the script grabs all the files you’ve downloaded that day and moves them into a backup/ directory with the current date. So you go from this:

1
2
3
4
5
  Downloads/
  ├── bar.1
  ├── bar.2
  ├── bar.3
  └── foo

To this:

1
2
3
4
5
6
7
  Downloads/
  └── backup
      └── 02-18
        ├── bar.1
        ├── bar.2
        ├── bar.3
        └── foo

The new files you’ve downloaded today go in the root of the downloads directory and are not moved until the chron job runs.

When automating this script, make sure you set the run time in the cron job to be at the end of the day and not hour 0 since that will run the next day and make for some confusing dates in your backups folder. I.e.

59 23 * * * ~/src/EmptyDownloads/script.sh

Enjoy!

Source on Github