Skip to content

Instantly share code, notes, and snippets.

@steelcowboy
Created July 17, 2020 04:43
Show Gist options
  • Save steelcowboy/46a2e59c7623dfc45c53998d4c0e48b5 to your computer and use it in GitHub Desktop.
Save steelcowboy/46a2e59c7623dfc45c53998d4c0e48b5 to your computer and use it in GitHub Desktop.
#!/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