From 575a6caced28aeb051f876d1c3db1a8188164685 Mon Sep 17 00:00:00 2001 From: Carl N Baldwin Date: Tue, 29 Nov 2005 19:43:18 -0700 Subject: [PATCH] This logic should bypass asking for a disk if no files are going to be copied from that disk. --- scripts/restore-script.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/restore-script.sh b/scripts/restore-script.sh index 0796bef..62042d5 100755 --- a/scripts/restore-script.sh +++ b/scripts/restore-script.sh @@ -37,6 +37,10 @@ dbfile=${rundir%%/}/backups.db dates=$(cat $dbfile | list-dates.sh) for date in $dates; do + filelist=$(tempfile) + # Check to see if files are actually needed from the current disk before requesting it. + cat $dbfile | files-from-date.sh $date | grep -z -Z -e "^${1%%/}/" > $filelist + if [ -s $filelist ]; then success=false while ! $success; do eject $device @@ -57,5 +61,9 @@ for date in $dates; do done rsyncopts="-W -H -S -l -p -t -g -o -0 --files-from=- --stats --progress" - cat $dbfile | files-from-date.sh $date | grep -z -Z -e "^${1%/}/" | rsync $rsyncopts ${mountdir%%/}/ ${2%%/}/ + cat $filelist | rsync $rsyncopts ${mountdir%%/}/ ${2%%/}/ + else + echo "No files are needed from disk: $date. Skipping it." + fi + rm -f $filelist done -- 2.34.1