# I use it to clean up latex build files from a directory after I'm done with the project.

#!/bin/bash

for f in *.tex; do
    h=$(basename "$f" .tex)
    echo "Trashing files accompanying $h.tex..."
    for g in "$h".*; do
        if [[ ${g: -4} != ".tex" && ${g: -4} != ".pdf" ]] ; then
            echo "Trashing $g..."
            totrash "$g"
        fi
    done
done
echo "Done!"