Skip to content

Instantly share code, notes, and snippets.

@mrlesmithjr
Last active August 14, 2020 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrlesmithjr/939f8b432759f335ff11fea1b19692d2 to your computer and use it in GitHub Desktop.
Save mrlesmithjr/939f8b432759f335ff11fea1b19692d2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
DEST="Backblaze:$(hostname | awk -F. '{ print $1}')"
OPTS=("--delete-excluded" "--links" "--fast-list" "-v")
DIRS=("$HOME/Desktop" "$HOME/Documents" "$HOME/Git_Projects" "$HOME/Pictures"
"$HOME/.kube" "$HOME/.ssh")
EXCLUDE=("Applications/**" "Documents/Snagit/Autosaved Captures.localized/**"
"Documents/Virtual Machines.localized/**" "Downloads/**" "Dropbox/**"
"Google Drive/**" "Library/Caches/**" "Library/Containers/com.docker.docker/**"
"Library/Dropbox/**" "Library/Logs/**" "Library/VirtualBox/**" "Library/WebKit/**"
"OneDrive/**" "VboxShared/**" "venv/**" "VirtualBox VMs/**" "Virtual Machines/**"
"Virtual Machines.localized/**" ".ansible_async/**" ".ansible/**" ".atom/**"
".cache/**" ".cups/**" ".docker/**" ".dropbox/**" ".gem/**" ".kube/cache/**"
".kube/http-cache/**" ".local/**" ".npm/**" ".nvm/**" ".packer.d/**" ".python-virtualenvs/**"
".rvm/**" ".terraform/**" ".terraform.d/**" ".Trash/**" ".vagrant.d/**"
".vscode/**" "*.box" "*.img" "*.iso" "*.ova" "*.ovf" "*.vdi" "*.vmdk" ".DS_STORE")
# Iterate over directories defined to backup
for DIR in "${DIRS[@]}"; do
if [[ -d "$DIR" ]]; then
echo "Backing up: $DIR"
rclone sync "${OPTS[@]}" --exclude $(echo ${EXCLUDE[@]} | sed -e 's/ / --exclude /g') "$DIR" "$DEST"/"${DIR#/}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment