#!/bin/bash # https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories # https://linuxhandbook.com/bash-arrays/ # https://stackoverflow.com/a/169517 remotedirs=('bookstack' 'gitea') # Server must have an ssh entry set up in ~/.ssh/config with the # host, user, port (if non-standard), and identityFile. server="vps-b" remotehome="~" localhome="/mnt/b/Backups" let mydirs="${#remotedirs[@]}-1" for i in $(seq 0 $mydirs); do echo "Downloading $server:$remotehome/${remotedirs[$i]}/ to $localhome/${remotedirs[$i]}/..." rsync -a $server:$remotehome/${remotedirs[$i]}/ $localhome/${remotedirs[$i]}/ done