view unarchivemany.sh @ 26:24d9dd63ae93

fixed handling of "." in directories
author casties
date Wed, 07 Dec 2005 18:31:04 +0100
parents 79c6618e8dfa
children 51d136834761
line wrap: on
line source

#!/bin/bash

VERSION="unarchivemany V0.1 (14.6.2005 ROC)"

if [ -z "$1$2" ]
then
    echo $VERSION
    echo "use: $0 docdir dirlist"
    echo "  Unrchives the directories given in the file dirlist inside docdir."
    exit 1
fi

BASEDIR="$1"
DIRLIST="$2"

if [ ! -d $BASEDIR ]
then
    echo "ERROR: base directory $BASEDIR not found!"
    exit 1
fi

if [ ! -f $DIRLIST ]
then
    echo "ERROR: directory list file $DIRLIST not found!"
    exit 1
fi

cat $DIRLIST | while read DIR
do
    if [ -d "$BASEDIR/$DIR" ]
    then
	echo "unarchiving $DIR..."
	if /usr/local/mpiwg/archive/unarchiver "$BASEDIR/$DIR"
	then
	    echo "  done on `date`"
	else
	    echo "FAILED!"
	    # abort?
	fi
    else
	echo "ERROR: document directory $BASEDIR/$DIR not found!"
    fi
done