From 07ce71f33f69886e2df24e6f79361db67809ce0e Mon Sep 17 00:00:00 2001 From: Taha Ahmed Date: Wed, 28 Dec 2011 17:23:11 +0100 Subject: [PATCH] Added an option to wipe the current directory. Crude implementation currently, but it appears to work. Good enough. --- chertex.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/chertex.sh b/chertex.sh index 9ce2f0a..8d0fe9a 100755 --- a/chertex.sh +++ b/chertex.sh @@ -108,6 +108,7 @@ else echo "This is cheRTeX POST-PROCESSING" # only one choice for now echo "<1> 'pdf-all' -- Process all .tikz files to pdf graphics" echo "<2> 'clean-up' -- Remove all auxiliary files" + echo "<3> 'wipe-dir' -- Remove all non-essential files and subdirectories" echo "Any other input exits the program" read usrchoice @@ -157,7 +158,25 @@ else if [[ $usrchoice == "clean-up" || $usrchoice == "2" ]]; then echo "<2> 'clean-up' chosen" rm $auxfiles - # Still a rather crude way of cleaning up... + # Still, a rather crude way of cleaning up... + fi + + if [[ $usrchoice == "wipe-dir" || $usrchoice == "3" ]]; then + echo "<3> 'wipe-dir' chosen" + ## Remove all but non-essential files + # get the name of the current directory + currdirname=${PWD##*/} + # make a directory in chepec/tmp with the name of the current dir + mkdir /home/taha/chepec/tmp/$currdirname + # Copy the contents of the current directory to the tmp/$currdirname directory + cp * -R /home/taha/chepec/tmp/$currdirname + # Empty the current directory of all contents + rm * -R # note: hidden files and subdir unaffected + # Return the stuff we want to keep after wipe-dir + cp /home/taha/chepec/tmp/$currdirname/*.Rnw . + cp /home/taha/chepec/tmp/$currdirname/vc . + cp /home/taha/chepec/tmp/$currdirname/vc.tex . + cp /home/taha/chepec/tmp/$currdirname/vc-git.awk . fi echo "Terminating..."