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

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.4     ! casties    30: cat  $DIRLIST | while read DIR
1.1       casties    31: do
1.3       casties    32:     CNT=$(( $CNT + 1 ))
1.1       casties    33:     if [ -d "$BASEDIR/$DIR" ]
                     34:     then
1.3       casties    35:    echo "$CNT: unarchiving $DIR..."
1.1       casties    36:    if /usr/local/mpiwg/archive/unarchiver "$BASEDIR/$DIR"
                     37:    then
                     38:        echo "  done on `date`"
                     39:    else
                     40:        echo "FAILED!"
                     41:        # abort?
                     42:    fi
                     43:     else
1.3       casties    44:    echo "$CNT: ERROR: document directory $BASEDIR/$DIR not found!"
1.1       casties    45:     fi
                     46: done
1.3       casties    47: 
1.4     ! casties    48: #if [ $CNT = "0" ]
        !            49: #then
        !            50: #    echo "$CNT ERROR: the list file $DIRLIST seems to be empty!"
        !            51: #fi

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