#!/bin/sh
##
# @file nuke_tex.sh
# @author Mitch Richling <http://www.mitchr.me/>
# @Copyright Copyright 1993 by Mitch Richling. All rights reserved.
# @brief Find or delete TeX generated files@EOL
# @Keywords delete junk backup tex object
# @Std sh
#
# Find .tex files, and nuke associated files generated by
# TeX and LaTeX in the CWD. Extra files that have no
# associated .tex file will NOT be deleted -- for example,
# foo.dvi file will only be deleted if foo.tex is found in
# the CWD. The only exception is if a directory named
# 'auto' will be deleted if a .tex file is fond in the CWD
# -- these get created by Emacs.
wd=`pwd`
if [ -n "$2" ] ; then
wd="$2"
fi
if [ "$1" = "-d" -o "$1" = "-p" ] ; then
for f in $wd/*.tex; do
bf=`echo $f | sed "s/.tex$//"`;
if [ -f $bf.tex ] ; then
echo "====================================="
echo "TEX FILE: $f"
if [ -d auto ] ; then
echo "WACKABLE: auto"
if [ "$1" = "-d" ] ; then
rm -rf auto
fi
fi
for e in tex~ bak ps tex.bak lg idv html pdf aux toc log dvi out hlog; do
if [ -f $bf.$e ] ; then
echo "WACKABLE: $bf.$e"
if [ "$1" = "-d" ] ; then
rm -f $bf.$e
fi
fi
done
fi
done
else
echo "USE: nuke_tex.sh <-d|-p>"
echo " -p => print"
echo " -d => delete"
fi
Generated by GNU Enscript 1.6.5.2.