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
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