Created
July 17, 2020 04:43
-
-
Save steelcowboy/46a2e59c7623dfc45c53998d4c0e48b5 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
#!/bin/bash | |
set -x | |
function join_by { local IFS="$1"; shift; echo "$*"; } | |
target=/mnt | |
src=/.snapshots/1/snapshot | |
paths=( | |
'dev/*' | |
'proc/*' | |
'sys/*' | |
'tmp/*' | |
'run/*' | |
'mnt/*' | |
'media/*' | |
'boot/*' | |
'home/*' | |
'opt/*' | |
'root/*' | |
'srv/*' | |
'usr/*' | |
'var/*' | |
) | |
result=$(join_by , "${paths[@]}") | |
bash -c 'rsync -aAXHv --exclude={'"${result}"'} '"$src/"' '"$target/"'' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment