Skip to content

Instantly share code, notes, and snippets.

@vsoch

vsoch/backup.sh

Created Oct 21, 2019
Embed
What would you like to do?
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
You can’t perform that action at this time.