#!/bin/sh ## This function will clean Texinfo project folders recursively. if [ -z "$1" ]; then WORKDIR="$PWD" else WORKDIR="$1" 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 ## linked to a TeX file in any manner. 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 \ -name "$FILE_NOEXT.vr" -o \ -name "$FILE_NOEXT.vrs" \) \ -print \ -delete done <