Faster version of "Clean downloads stack"

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!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s