process exclusions

This commit is contained in:
Asif Bacchus 2020-03-26 05:40:23 -06:00
parent bcb6c9c5ef
commit ff98225921

View File

@ -261,14 +261,21 @@ elif [ "$operation" = 'viewarchive' ]; then
borg list ::"${archiveName}"
# restore operations
elif [ "$operation" = 'restore' ]; then
cd "$restorePath" || consoleError 4 'Could not change to restore directory.'
if [ -z "$fileName" ]; then
# restore entire archive
cd "$restorePath" || consoleError 4 'Could not change to restore directory.'
borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}"
if [ "$exclusions" ]; then
borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}" --exclude "${exclusions}"
else
borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}"
fi
elif [ "$fileName" ]; then
# restore single file
cd "$restorePath" || consoleError 4 'Could not change to restore directory.'
borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}" "${fileName}"
# restore file/pattern
if [ "$exclusions" ]; then
borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}" "${fileName}" --exclude "${exclusions}"
else
borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}" "${fileName}"
fi
fi
fi