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

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

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