Skip to content

Instantly share code, notes, and snippets.

@dpkoch
Last active October 5, 2016 00:24
Show Gist options
  • Save dpkoch/7fa3aea40dba544ece3e to your computer and use it in GitHub Desktop.
Save dpkoch/7fa3aea40dba544ece3e to your computer and use it in GitHub Desktop.
Bash script for removing generated LaTeX files
#!/bin/bash
EXTENSIONS=".aux .log .nav .out .snm .synctex.gz .toc .bbl .blg -blx.bib .bcf .run.xml .acn .acr .alg .glg .glo .gls .ist .lof .lot .auxlock .synctex.gz(busy) .vrb .fls .fdb_latexmk .latexmk"
MAXDEPTH="-maxdepth 1"
if [ "$1" = "-r" ] || [ "$1" = "-R" ]; then
MAXDEPTH=""
fi
find . $MAXDEPTH -type f -name "*.tex" | while read FILE
do
DIRNAME=$(dirname "$FILE")
FILENAME=$(basename "$FILE" .tex)
for EXT in $EXTENSIONS; do
rm -vf "$DIRNAME/$FILENAME$EXT"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment