version 1.4, 2005/10/05 13:35:12
|
version 1.5, 2006/06/23 09:58:17
|
Line 1
|
Line 1
|
#!/bin/bash |
#!/bin/bash |
|
|
VERSION="archivemany V0.2 (23.9.2005 ROC)" |
VERSION="archivemany V0.3 (23.6.2006 ROC)" |
|
|
#set -x |
#set -x |
|
|
if [ -z "$1$2" ] |
if [ -z "$1$2" ] |
then |
then |
echo $VERSION |
echo $VERSION |
echo "use: $0 docdir dirlist" |
echo "use: $0 docdir dirlist [params...]" |
echo " Archives the directories given in the file dirlist inside docdir." |
echo " Archives the directories given in the file dirlist inside docdir." |
exit 1 |
exit 1 |
fi |
fi |
Line 17 DIRLIST="$2"
|
Line 17 DIRLIST="$2"
|
PARAM1="$3" |
PARAM1="$3" |
PARAM2="$4" |
PARAM2="$4" |
PARAM3="$5" |
PARAM3="$5" |
CNT="1" |
|
|
|
if [ ! -d $BASEDIR ] |
if [ ! -d $BASEDIR ] |
then |
then |
Line 31 then
|
Line 30 then
|
exit 1 |
exit 1 |
fi |
fi |
|
|
cat $DIRLIST | while read DIR |
CNT=0 |
|
|
|
# read directories from DIRLIST |
|
while read DIR |
do |
do |
|
CNT=$(( $CNT + 1 )) |
if [ -d "$BASEDIR/$DIR" ] |
if [ -d "$BASEDIR/$DIR" ] |
then |
then |
echo "archiving document $CNT: $DIR..." |
echo "archiving document $CNT: $DIR..." |
Line 44 do
|
Line 47 do
|
# abort? |
# abort? |
fi |
fi |
else |
else |
echo "ERROR: document directory $BASEDIR/$DIR not found!" |
echo "$CNT ERROR: document directory $BASEDIR/$DIR not found!" |
|
fi |
|
done < $DIRLIST |
|
|
|
if [ $CNT = 0 ] |
|
then |
|
echo "ERROR: the list file $DIRLIST seems to be empty!" |
fi |
fi |
CNT=$(( $CNT + 1 )) |
|
done |
|