File:  [Repository] / foxridge-archiver / unarchivemany.sh
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Fri Jun 23 09:40:12 2006 UTC (18 years ago) by casties
Branches: MAIN
CVS tags: HEAD
still issues with "while read"

    1: #!/bin/bash
    2: 
    3: VERSION="unarchivemany V0.2 (23.6.2006 ROC)"
    4: 
    5: if [ -z "$1$2" ]
    6: then
    7:     echo $VERSION
    8:     echo "use: $0 docdir dirlist"
    9:     echo "  Unarchives the directories given in the file dirlist inside docdir."
   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: 
   28: CNT=0
   29: 
   30: cat  $DIRLIST | while read DIR
   31: do
   32:     CNT=$(( $CNT + 1 ))
   33:     if [ -d "$BASEDIR/$DIR" ]
   34:     then
   35: 	echo "$CNT: unarchiving $DIR..."
   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
   44: 	echo "$CNT: ERROR: document directory $BASEDIR/$DIR not found!"
   45:     fi
   46: done
   47: 
   48: #if [ $CNT = "0" ]
   49: #then
   50: #    echo "$CNT ERROR: the list file $DIRLIST seems to be empty!"
   51: #fi
   52: 

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