Skip to content

Instantly share code, notes, and snippets.

@vsoch
Created October 21, 2019 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsoch/5e5467ac654ad83a0c60c75f55053dfd to your computer and use it in GitHub Desktop.
Save vsoch/5e5467ac654ad83a0c60c75f55053dfd to your computer and use it in GitHub Desktop.
An example of using rsync to backup three folders in Documents to an external drive, checking that it's mounted first
#!/bin/bash
output=/media/$USER/My\ Passport/vubuntu/
if [ ! -d "$output" ]; then
echo "$output not found, is drive connected to computer?"
exit 1
fi
for folder in "Personal" "Transcripts" "Resume"; do
rsync -avzh /home/$USER/Documents/$folder $output
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment