Added a time-check in clean.sh.
authorFrancois Fleuret <francois@fleuret.org>
Tue, 14 Jun 2011 06:51:58 +0000 (08:51 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Tue, 14 Jun 2011 06:51:58 +0000 (08:51 +0200)
clean.sh

index 99f39ef..4ca5db6 100755 (executable)
--- 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