2014-05-07 19:01:05 +02:00
|
|
|
#!/bin/sh
|
2013-03-03 11:19:50 +01:00
|
|
|
|
2013-06-25 22:56:10 +02:00
|
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
|
2014-11-12 16:15:39 +01:00
|
|
|
cat <<EOF
|
2013-10-23 11:25:40 +02:00
|
|
|
Usage: ${0##*/} FOLDERS
|
|
|
|
|
|
|
|
Clean TeX/LaTeX/Texinfo project folders recursively.
|
|
|
|
|
|
|
|
First we look for .tex or .texi files, and then we can remove associated
|
|
|
|
extensions in current folder. We proceed this way so that we do not incidentally
|
|
|
|
remove files matching these extensions if they are not linked to a TeX file in
|
|
|
|
any manner.
|
2013-06-25 22:56:10 +02:00
|
|
|
|
|
|
|
EOF
|
2014-11-12 16:15:39 +01:00
|
|
|
exit
|
2013-06-25 22:56:10 +02:00
|
|
|
fi
|
|
|
|
|
2013-10-23 11:25:40 +02:00
|
|
|
for i ; do
|
2014-11-12 16:15:39 +01:00
|
|
|
while read -r FILE; do
|
|
|
|
case FILE in
|
|
|
|
*/*) ;;
|
|
|
|
*)
|
|
|
|
FILE="./$FILE" ;;
|
|
|
|
esac
|
|
|
|
DIRNAME="${FILE%/*}"
|
|
|
|
BASENAME="${FILE##*/}"
|
|
|
|
BASENAME="${BASENAME%.*}"
|
|
|
|
rm -v $(
|
|
|
|
for j in aux bbl blg cp cps fn glg glo gls idx ilg ind ky lof log maf mt mtc nav out pg snm synctex.gz synctex tns toc tp vr vrs xdy
|
|
|
|
do
|
|
|
|
echo "$DIRNAME/$BASENAME.$j"
|
|
|
|
done) 2>/dev/null
|
|
|
|
done <<EOF
|
2013-10-23 11:25:40 +02:00
|
|
|
$(find "$i" -type f \( -name "*.tex" -o -name "*.texi" \) )
|
2013-03-16 16:44:58 +01:00
|
|
|
EOF
|
2013-10-23 11:25:40 +02:00
|
|
|
done
|