From: Francois Fleuret Date: Tue, 14 Jun 2011 06:51:58 +0000 (+0200) Subject: Added a time-check in clean.sh. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=d603ace3229f8ddc962141b62803642988ee89c4;p=scripts.git Added a time-check in clean.sh. --- diff --git a/clean.sh b/clean.sh index 99f39ef..4ca5db6 100755 --- a/clean.sh +++ b/clean.sh @@ -24,7 +24,7 @@ TRASH=$(mktemp -d /tmp/trash.XXXXXX) for i in "nav:tex" "snm:tex" "toc:tex" "blg:tex" \ "idx:tex" "ilg:tex" "ind:tex" "lof:tex" "lot:tex" "lou:tex" \ "dvi:tex" "log:tex" "aux:tex" "bbl:tex" \ - "ps:tex" "pdf:tex" "out:tex" "tpt:tex" "brf:tex" \ + "ps:tex" "pdf:tex" "out:tex" "tpt:tex" "brf:tex" "vrb:tex" \ "eps:fig" "eps:png" "eps:pgm" \ "o:cc" "o:c" ; do PRODUCED=$(echo $i | cut -f 1 -d:) @@ -32,8 +32,12 @@ for i in "nav:tex" "snm:tex" "toc:tex" "blg:tex" \ for f in *.$PRODUCED; do ORIGINAL=${f/.$PRODUCED/.$SOURCE} if [ -f "${ORIGINAL}" ]; then - echo "move $f to ${TRASH} ($ORIGINAL exists)" - mv $f ${TRASH} + if [ "${f}" -nt "${ORIGINAL}" ]; then + echo "Moving file $f to ${TRASH} ($ORIGINAL exists)" + mv $f ${TRASH} + else + echo "File $f is older than $ORIGINAL. Keeping both." + fi fi done done