Skip to content

Instantly share code, notes, and snippets.

@TaurusOlson
Created September 10, 2009 17:22
Show Gist options
  • Save TaurusOlson/184665 to your computer and use it in GitHub Desktop.
Save TaurusOlson/184665 to your computer and use it in GitHub Desktop.
#! /bin/bash
##############################################################################
# cleanlatex 0.1
# by Taurus Olson
# 1/02/09
#cleanlatex is a small program made in order to clean Latex directories full of useless files
# before removing them all he makes a backup directory that you can delete if you're sure it is safe
##############################################################################
directory=cleaned
for useless in *.toc *.mtc* *.maf *.aux *.bbl *.blg *.log *.out *.stc* *.ptc* *.nav *.snm
do
if [[ -f $PWD/$useless ]]
then
echo $PWD/$useless
if [[ -d $PWD/$directory ]]
then
cp $PWD/$useless $PWD/$directory
else mkdir $PWD/$directory
cp $PWD/$useless $PWD/$directory
fi
fi
done
value=0
for useless in *.toc *.mtc* *.maf *.aux *.bbl *.blg *.log *.out *.stc* *.ptc* *.nav *.snm
do
if [[ -f $useless ]]
then
rm $useless
(( value= value + 1 ))
fi
done
echo -e "\n"$value "files were deleted."
~
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment