BrT

Musings about technology and other neat stuff

BrT random header image

Faster version of “Clean downloads stack”

December 10th, 2008 · No Comments

For some time I have been using this technique (with the variation mentioned in my comment: use the application also as the stack overlay icon) to clean my Downloads stack in the OSX dock. The only problem with using an Automator app is that it is quite slow, so I have replaced it with a shell script that does the same thing: remove every file in the Downloads directory except itself. I have made an OSX application from the script using the fantastic Platypus, and you can download it here. To use it:

  1. Unpack the zip file and put the ” Clean Downloads stack” application in your Downloads folder.
  2. Run the following command:
    touch -mt 202001010101.01 " Clean downloads stack.app"

If you want to roll your own, here’s the script (which you can find inside the app as Contents/Resources/script:

#!/bin/bash
DIR="$HOME/Downloads"
cd $DIR
ls -1 | grep -v 'Clean downloads stack' | sed 's/^/rm -rf "/; s/$/"/' | bash

This does the same as the Automator workflow from the original hint, but much, much faster. Of course, you may want to change its icon to match your selected overlay icons.

Enjoy!

Tags: · · ·