OS X - 'Clickable' script to erase files?
Create a text file like this:

#!/bin/bash

cd "$(dirname "${BASH_SOURCE[0]}")" || {
    echo "Error changing directory." &gt;&amp;2
    exit 1
}

echo "Cleaning files..."

rm *.aux
rm *.bak
rm *.bbl
rm *.blg
rm *.gz
rm *.log
rm *.pdf

echo "Done!"


Give it a ".command" extension, and add execute permission to it. This will make it automatically open and run in Terminal when it's double-clicked.

Note that there are two important differences (and one minor one) between this and @thiagoveloso's script:


It uses double-quotes around the path it's cding to, which will prevent problems if any directory names contain spaces (which is entirely normal on OS X).
It checks for errors while cding, and if there was a problem it exits (rather than deleting files in an unexpected location). Always check for errors on any script command that affects what the rest of the script will do; cd is a good example of this.
(Minor) It cds directly to the script's directory (rather than cding there, capturing that location in a variable, then cding there again based on the variable).