annotate unarchivemany.sh @ 43:27f273329930

fixed wrong placement of access-conditions tag
author casties
date Mon, 11 Dec 2006 19:07:43 +0100
parents 9eb746dc69f8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
1 #!/bin/bash
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
2
34
51d136834761 added error message for empty list file
casties
parents: 20
diff changeset
3 VERSION="unarchivemany V0.2 (23.6.2006 ROC)"
15
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
4
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
5 if [ -z "$1$2" ]
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
6 then
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
7 echo $VERSION
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
8 echo "use: $0 docdir dirlist"
34
51d136834761 added error message for empty list file
casties
parents: 20
diff changeset
9 echo " Unarchives the directories given in the file dirlist inside docdir."
15
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
10 exit 1
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
11 fi
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
12
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
13 BASEDIR="$1"
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
14 DIRLIST="$2"
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
15
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
16 if [ ! -d $BASEDIR ]
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
17 then
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
18 echo "ERROR: base directory $BASEDIR not found!"
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
19 exit 1
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
20 fi
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
21
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
22 if [ ! -f $DIRLIST ]
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
23 then
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
24 echo "ERROR: directory list file $DIRLIST not found!"
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
25 exit 1
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
26 fi
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
27
34
51d136834761 added error message for empty list file
casties
parents: 20
diff changeset
28 CNT=0
51d136834761 added error message for empty list file
casties
parents: 20
diff changeset
29
36
9eb746dc69f8 while read loop works now!
casties
parents: 35
diff changeset
30 # read directories from DIRLIST
9eb746dc69f8 while read loop works now!
casties
parents: 35
diff changeset
31 while read DIR
15
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
32 do
34
51d136834761 added error message for empty list file
casties
parents: 20
diff changeset
33 CNT=$(( $CNT + 1 ))
15
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
34 if [ -d "$BASEDIR/$DIR" ]
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
35 then
34
51d136834761 added error message for empty list file
casties
parents: 20
diff changeset
36 echo "$CNT: unarchiving $DIR..."
15
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
37 if /usr/local/mpiwg/archive/unarchiver "$BASEDIR/$DIR"
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
38 then
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
39 echo " done on `date`"
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
40 else
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
41 echo "FAILED!"
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
42 # abort?
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
43 fi
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
44 else
34
51d136834761 added error message for empty list file
casties
parents: 20
diff changeset
45 echo "$CNT: ERROR: document directory $BASEDIR/$DIR not found!"
15
8d2f0586eca6 new helper script for calling archiver on many directories
casties
parents:
diff changeset
46 fi
36
9eb746dc69f8 while read loop works now!
casties
parents: 35
diff changeset
47 done < $DIRLIST
34
51d136834761 added error message for empty list file
casties
parents: 20
diff changeset
48
36
9eb746dc69f8 while read loop works now!
casties
parents: 35
diff changeset
49 if [ $CNT = 0 ]
9eb746dc69f8 while read loop works now!
casties
parents: 35
diff changeset
50 then
9eb746dc69f8 while read loop works now!
casties
parents: 35
diff changeset
51 echo "$CNT ERROR: the list file $DIRLIST seems to be empty!"
9eb746dc69f8 while read loop works now!
casties
parents: 35
diff changeset
52 fi