view archivemany.sh @ 22:c3defe3e2780

corrected perl lib path
author casties
date Tue, 20 Sep 2005 19:44:48 +0200
parents fdf4ceb36db1
children a3c35eae25dc
line wrap: on
line source

#!/bin/bash

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

#set -x

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

BASEDIR="$1"
DIRLIST="$2"
PARAM="$3"

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 "archiving $DIR..."
	if /usr/local/mpiwg/archive/archiver "$PARAM" "$BASEDIR/$DIR"
	then
	    echo "  done on `date`"
	else
	    echo "FAILED!"
	    # abort?
	fi
    else
	echo "ERROR: document directory $BASEDIR/$DIR not found!"
    fi
done