diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index e6b9404..b575bcb 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -4,15 +4,15 @@ "fsPath": "$ROOTPATH$/borghelper.sh", "bookmarks": [ -1, - 253, - 151, + 261, + 159, -1, -1, -1, -1, -1, -1, - 84 + 92 ] } ] diff --git a/borghelper.sh b/borghelper.sh index acaaac3..7b8b856 100755 --- a/borghelper.sh +++ b/borghelper.sh @@ -69,6 +69,14 @@ while [ $# -gt 0 ]; do archiveName="$2" shift ;; + --exclude) + # exclude files from restore + if [ -z "$2" ]; then + consoleError 1 "Please provide a list of exclusions in the proper borg format." + fi + exclusions="$2" + shift + ;; -f|--file) # specific file to restore if [ -z "$2" ]; then @@ -173,8 +181,8 @@ if [ "$fileName" ] && [ -z "$archiveName" ]; then fi # clean-up leading spaces in option strings -commonOptions=${commonOptions##[[:space:]]} -restoreOptions=${restoreOptions##[[:space:]]} +if [ "$commonOptions" ]; then commonOptions=${commonOptions##[[:space:]]}; fi +if [ "$restoreOptions" ]; then restoreOptions=${restoreOptions##[[:space:]]}; fi ### read borg information file @@ -256,11 +264,11 @@ elif [ "$operation" = 'restore' ]; then if [ -z "$fileName" ]; then # restore entire archive cd "$restorePath" || consoleError 4 'Could not change to restore directory.' - borg --show-rc "$commonOptions" extract "$restoreOptions" ::"${archiveName}" + borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}" elif [ "$fileName" ]; then # restore single file cd "$restorePath" || consoleError 4 'Could not change to restore directory.' - borg --show-rc "$commonOptions" extract "$restoreOptions" ::"${archiveName}" "${fileName}" + borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}" "${fileName}" fi fi