File:  [Repository] / foxridge-archiver / archivemany.sh
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Mon Jun 20 15:21:30 2005 UTC (19 years ago) by casties
Branches: MAIN
CVS tags: HEAD
new helper script for calling archiver on many directories

#!/bin/bash

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

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"

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 "$BASEDIR/$DIR"
	then
	    echo "  done on `date`"
	else
	    echo "FAILED!"
	    # abort?
	fi
    else
	echo "ERROR: document directory $BASEDIR/$DIR not found!"
    fi
done

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