Annotation of foxridge-archiver/archivemany.sh, revision 1.5

1.1       casties     1: #!/bin/bash
                      2: 
1.5     ! casties     3: VERSION="archivemany V0.3 (23.6.2006 ROC)"
1.1       casties     4: 
1.2       casties     5: #set -x
                      6: 
1.1       casties     7: if [ -z "$1$2" ]
                      8: then
                      9:     echo $VERSION
1.5     ! casties    10:     echo "use: $0 docdir dirlist [params...]"
1.1       casties    11:     echo "  Archives the directories given in the file dirlist inside docdir."
                     12:     exit 1
                     13: fi
                     14: 
                     15: BASEDIR="$1"
                     16: DIRLIST="$2"
1.4       casties    17: PARAM1="$3"
                     18: PARAM2="$4"
                     19: PARAM3="$5"
1.1       casties    20: 
                     21: if [ ! -d $BASEDIR ]
                     22: then
                     23:     echo "ERROR: base directory $BASEDIR not found!"
                     24:     exit 1
                     25: fi
                     26: 
                     27: if [ ! -f $DIRLIST ]
                     28: then
                     29:     echo "ERROR: directory list file $DIRLIST not found!"
                     30:     exit 1
                     31: fi
                     32: 
1.5     ! casties    33: CNT=0
        !            34: 
        !            35: # read directories from DIRLIST
        !            36: while read DIR
1.1       casties    37: do
1.5     ! casties    38:     CNT=$(( $CNT + 1 ))
1.1       casties    39:     if [ -d "$BASEDIR/$DIR" ]
                     40:     then
1.3       casties    41:    echo "archiving document $CNT: $DIR..."
1.4       casties    42:    if /usr/local/mpiwg/archive/archiver "$PARAM1" "$PARAM2" "$PARAM3" "$BASEDIR/$DIR"
1.1       casties    43:    then
                     44:        echo "  done on `date`"
                     45:    else
                     46:        echo "FAILED!"
                     47:        # abort?
                     48:    fi
                     49:     else
1.5     ! casties    50:    echo "$CNT ERROR: document directory $BASEDIR/$DIR not found!"
1.1       casties    51:     fi
1.5     ! casties    52: done < $DIRLIST
        !            53: 
        !            54: if [ $CNT = 0 ]
        !            55: then
        !            56:     echo "ERROR: the list file $DIRLIST seems to be empty!"
        !            57: fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>