Last active
August 14, 2020 18:14
-
-
Save mrlesmithjr/939f8b432759f335ff11fea1b19692d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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