EXCLUDES=( "/syncthing" "/Movies" ".thumbnails" "/Android" "/Download/Images" ) RSYNC_COMMAND=( rsync --partial --info=progress2 --verbose --no-i-r -a --delete "${EXCLUDES[@]/#/--exclude=}" ) SOURCE_LOCATION="/storage/emulated/0/" HOSTNAME="android-phone" REMOTE_HOST="user@example.com" DESTINATION_LOCATION="~/tmp/borg/$HOSTNAME/" BORG_REPO="runner2:borg/$HOSTNAME" BORG_COMMAND=( borg --remote-path borg1 --verbose --progress ) CREATE_COMMAND=( "${BORG_COMMAND[@]}" create --stats --one-file-system --exclude-caches --compression=auto,lzma ) PRUNE_COMMAND=( "${BORG_COMMAND[@]}" prune --list --keep-daily=7 --keep-weekly=4 --keep-monthly=2 ) run_remote() { if (( $# == 0 )); then echo "No arguments given to run_remote" >&2 return 1 fi ssh "$REMOTE_HOST" -- "cd" "$DESTINATION_LOCATION" "&&" "pwd" "&&" "${@}" }