2014-04-30 07:51:59 +02:00
|
|
|
#!/bin/sh -x
|
2013-03-03 11:19:50 +01:00
|
|
|
|
2013-06-25 22:56:10 +02:00
|
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
|
|
|
|
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
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2013-10-23 11:25:40 +02:00
|
|
|
for i ; do
|
2014-04-02 15:00:06 +02:00
|
|
|
while read -r FILE; do
|
2013-10-23 11:25:40 +02:00
|
|
|
FILE_NOEXT="${FILE##*/}"
|
|
|
|
FILE_NOEXT="${FILE_NOEXT%.*}"
|
|
|
|
FILE_PATH="${FILE%/*}"
|
2014-04-30 07:51:59 +02:00
|
|
|
rm -v $(for j in \
|
2014-04-02 15:00:06 +02:00
|
|
|
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
|
2014-04-30 07:51:59 +02:00
|
|
|
echo "$FILE_PATH/$FILE_NOEXT.$j"
|
2014-04-02 15:00:06 +02:00
|
|
|
done) 2>/dev/null
|
2013-10-23 11:25:40 +02:00
|
|
|
done <<EOF
|
|
|
|
$(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
|