Mercurial > hg > foxridge-archiver
comparison unarchivemany.sh @ 34:51d136834761
added error message for empty list file
author | casties |
---|---|
date | Fri, 23 Jun 2006 10:57:56 +0200 |
parents | 79c6618e8dfa |
children | e27d097a9d87 |
comparison
equal
deleted
inserted
replaced
33:9868f6ed9a54 | 34:51d136834761 |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 VERSION="unarchivemany V0.1 (14.6.2005 ROC)" | 3 VERSION="unarchivemany V0.2 (23.6.2006 ROC)" |
4 | 4 |
5 if [ -z "$1$2" ] | 5 if [ -z "$1$2" ] |
6 then | 6 then |
7 echo $VERSION | 7 echo $VERSION |
8 echo "use: $0 docdir dirlist" | 8 echo "use: $0 docdir dirlist" |
9 echo " Unrchives the directories given in the file dirlist inside docdir." | 9 echo " Unarchives the directories given in the file dirlist inside docdir." |
10 exit 1 | 10 exit 1 |
11 fi | 11 fi |
12 | 12 |
13 BASEDIR="$1" | 13 BASEDIR="$1" |
14 DIRLIST="$2" | 14 DIRLIST="$2" |
23 then | 23 then |
24 echo "ERROR: directory list file $DIRLIST not found!" | 24 echo "ERROR: directory list file $DIRLIST not found!" |
25 exit 1 | 25 exit 1 |
26 fi | 26 fi |
27 | 27 |
28 CNT=0 | |
29 | |
28 cat $DIRLIST | while read DIR | 30 cat $DIRLIST | while read DIR |
29 do | 31 do |
32 CNT=$(( $CNT + 1 )) | |
30 if [ -d "$BASEDIR/$DIR" ] | 33 if [ -d "$BASEDIR/$DIR" ] |
31 then | 34 then |
32 echo "unarchiving $DIR..." | 35 echo "$CNT: unarchiving $DIR..." |
33 if /usr/local/mpiwg/archive/unarchiver "$BASEDIR/$DIR" | 36 if /usr/local/mpiwg/archive/unarchiver "$BASEDIR/$DIR" |
34 then | 37 then |
35 echo " done on `date`" | 38 echo " done on `date`" |
36 else | 39 else |
37 echo "FAILED!" | 40 echo "FAILED!" |
38 # abort? | 41 # abort? |
39 fi | 42 fi |
40 else | 43 else |
41 echo "ERROR: document directory $BASEDIR/$DIR not found!" | 44 echo "$CNT: ERROR: document directory $BASEDIR/$DIR not found!" |
42 fi | 45 fi |
43 done | 46 done |
47 | |
48 if [ $CNT = 0 ] | |
49 then | |
50 echo "ERROR: the list file $DIRLIST seems to be empty!" | |
51 fi |