From d603ace3229f8ddc962141b62803642988ee89c4 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Tue, 14 Jun 2011 08:51:58 +0200 Subject: [PATCH] Added a time-check in clean.sh. --- clean.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 -- 2.39.5