2013-03-16 16:44:58 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-06-25 22:56:10 +02:00
|
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
|
|
|
|
cat <<EOF
|
|
|
|
Usage: ${0##*/} [FOLDER]
|
|
|
|
|
|
|
|
Clean Texinfo project folders recursively.
|
|
|
|
EOF
|
|
|
|
exit
|
2013-03-16 16:44:58 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
## First we need to get the name of a .texi file, and then we can remove
|
|
|
|
## associated extensions in current folder. We proceed this way so that we do
|
|
|
|
## not remove incidentally files matching these extensions even if they are not
|
2013-06-25 22:56:10 +02:00
|
|
|
## linked to a texinfo file in any manner.
|
2013-03-16 16:44:58 +01:00
|
|
|
while read -r FILE; do
|
|
|
|
FILE_NOEXT="${FILE##*/}"
|
|
|
|
FILE_NOEXT="${FILE_NOEXT%.*}"
|
|
|
|
FILE_PATH="${FILE%/*}"
|
|
|
|
find "$FILE_PATH" -maxdepth 1 -type f \( \
|
|
|
|
-name "$FILE_NOEXT.aux" -o \
|
|
|
|
-name "$FILE_NOEXT.cp" -o \
|
|
|
|
-name "$FILE_NOEXT.cps" -o \
|
|
|
|
-name "$FILE_NOEXT.fn" -o \
|
|
|
|
-name "$FILE_NOEXT.ky" -o \
|
|
|
|
-name "$FILE_NOEXT.log" -o \
|
|
|
|
-name "$FILE_NOEXT.pg" -o \
|
|
|
|
-name "$FILE_NOEXT.toc" -o \
|
|
|
|
-name "$FILE_NOEXT.tp" -o \
|
2013-03-17 09:18:57 +01:00
|
|
|
-name "$FILE_NOEXT.vr" -o \
|
2013-03-17 09:15:32 +01:00
|
|
|
-name "$FILE_NOEXT.vrs" \) \
|
2013-03-16 16:44:58 +01:00
|
|
|
-print \
|
|
|
|
-delete
|
|
|
|
done <<EOF
|
|
|
|
$(find "$WORKDIR" -type f -name "*.texi")
|
|
|
|
EOF
|
|
|
|
|