From 710b12deaa57cf3d45a9dbadc08aa4330c80a9bf Mon Sep 17 00:00:00 2001 From: Taha Ahmed Date: Wed, 28 Dec 2011 18:49:17 +0100 Subject: [PATCH] Added a timestamp to the dirname in the tmp directory. This ensures uniqueness. --- chertex.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/chertex.sh b/chertex.sh index 8d0fe9a..5b3a55f 100755 --- a/chertex.sh +++ b/chertex.sh @@ -166,17 +166,21 @@ else ## Remove all but non-essential files # get the name of the current directory currdirname=${PWD##*/} + # get a timestamp + timestamp=$(date +%s) + # create a unique tmp-dir name + tmpdirname="${timestamp}-${currdirname}" # make a directory in chepec/tmp with the name of the current dir - mkdir /home/taha/chepec/tmp/$currdirname + mkdir /home/taha/chepec/tmp/$tmpdirname # Copy the contents of the current directory to the tmp/$currdirname directory - cp * -R /home/taha/chepec/tmp/$currdirname + cp * -R /home/taha/chepec/tmp/$tmpdirname # 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 . + cp /home/taha/chepec/tmp/$tmpdirname/*.Rnw . + cp /home/taha/chepec/tmp/$tmpdirname/vc . + cp /home/taha/chepec/tmp/$tmpdirname/vc.tex . + cp /home/taha/chepec/tmp/$tmpdirname/vc-git.awk . fi echo "Terminating..."