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:
- Unpack the zip file and put the ” Clean Downloads stack” application in your Downloads folder.
- 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.