Skip to content

Instantly share code, notes, and snippets.

@RagingTiger
Created January 4, 2023 20:04
Show Gist options
  • Save RagingTiger/b2c211b258a13e7848904a426167fe24 to your computer and use it in GitHub Desktop.
Save RagingTiger/b2c211b258a13e7848904a426167fe24 to your computer and use it in GitHub Desktop.
backup(){
# target sink
local target="${1:-"/Volumes/${YOUR_VOLUME}"}"
# target sources
local sources=$HOME
# check volume mounted
if mount | grep -q "on ${target}"; then
rsync -havP --exclude={Desktop,Downloads,Library,Movies,Pictures,Public,.Trash} \
${sources} ${target}
else
echo "Could not find ${target} in /Volumes."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment