From b9314edb78205eeeba6b71b2f953471e6c425c19 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 14 Nov 2006 23:35:10 +0100 Subject: [PATCH] Some count tests --- ccollect.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ccollect.sh b/ccollect.sh index f780091..9ad3e86 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -14,7 +14,7 @@ CPREEXEC="$CDEFAULTS/pre_exec" CPOSTEXEC="$CDEFAULTS/post_exec" TMP=$(mktemp /tmp/$(basename $0).XXXXXX) -VERSION=0.5.X +VERSION=0.5.2 RELEASE="2006-XXXXX" HALF_VERSION="ccollect $VERSION" FULL_VERSION="ccollect $VERSION ($RELEASE)" @@ -377,7 +377,7 @@ while [ "$i" -lt "$no_sources" ]; do # # the created directories are named $INTERVAL-$DATE-$TIME.$PID - count=$(ls -d "$c_dest/${INTERVAL}."?* 2>/dev/null | wc -l | sed 's/^ *//g') + count=$(cd "$c_dest" && ls -p1 | grep "^${INTERVAL}\..*/\$" | wc -l | sed 's/^ *//g') echo -n "Currently $count backup(s) exist(s)," echo " total keeping $c_interval backup(s)." @@ -387,6 +387,7 @@ while [ "$i" -lt "$no_sources" ]; do echo "Removing $remove backup(s)..." ls -d "$c_dest/${INTERVAL}."?* | sort -n | head -n $remove > "$TMP" + #( cd "$c_dest" && ls -p1 | grep "^${INTERVAL}\..*/\$" | sort -n | head -n $remove > "$TMP" while read to_remove; do dir="$to_remove" echo "Removing $dir ..."