--- foxridge-archiver/archivemany.sh 2005/10/05 13:35:12 1.4 +++ foxridge-archiver/archivemany.sh 2006/06/23 09:58:17 1.5 @@ -1,13 +1,13 @@ #!/bin/bash -VERSION="archivemany V0.2 (23.9.2005 ROC)" +VERSION="archivemany V0.3 (23.6.2006 ROC)" #set -x if [ -z "$1$2" ] then echo $VERSION - echo "use: $0 docdir dirlist" + echo "use: $0 docdir dirlist [params...]" echo " Archives the directories given in the file dirlist inside docdir." exit 1 fi @@ -17,7 +17,6 @@ DIRLIST="$2" PARAM1="$3" PARAM2="$4" PARAM3="$5" -CNT="1" if [ ! -d $BASEDIR ] then @@ -31,8 +30,12 @@ then exit 1 fi -cat $DIRLIST | while read DIR +CNT=0 + +# read directories from DIRLIST +while read DIR do + CNT=$(( $CNT + 1 )) if [ -d "$BASEDIR/$DIR" ] then echo "archiving document $CNT: $DIR..." @@ -44,7 +47,11 @@ do # abort? fi else - echo "ERROR: document directory $BASEDIR/$DIR not found!" + echo "$CNT ERROR: document directory $BASEDIR/$DIR not found!" fi - CNT=$(( $CNT + 1 )) -done +done < $DIRLIST + +if [ $CNT = 0 ] +then + echo "ERROR: the list file $DIRLIST seems to be empty!" +fi