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
|
2015-12-02 02:23:44 +01:00
|
|
|
while read -r file; do
|
|
|
|
case "$file" in
|
2014-11-12 16:15:39 +01:00
|
|
|
*/*) ;;
|
|
|
|
*)
|
2015-12-02 02:23:44 +01:00
|
|
|
file="./$file" ;;
|
2014-11-12 16:15:39 +01:00
|
|
|
esac
|
2015-12-02 02:23:44 +01:00
|
|
|
dirname="${file%/*}"
|
|
|
|
basename="${file##*/}"
|
|
|
|
basename="${basename%.*}"
|
|
|
|
## Reset arg list (big performance boost).
|
|
|
|
set --
|
|
|
|
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
|
|
|
|
set -- "$@" "$dirname/$basename.$j"
|
|
|
|
done
|
|
|
|
rm -v "$@" 2>/dev/null
|
2014-11-12 16:15:39 +01:00
|
|
|
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
|