Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@michaelmcmillan
Created November 18, 2015 19:30
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 michaelmcmillan/269c544091ad6f01083f to your computer and use it in GitHub Desktop.
Save michaelmcmillan/269c544091ad6f01083f to your computer and use it in GitHub Desktop.
#!/bin/sh
# Google Drive client
DRIVE=/usr/local/bin/drive
# What to backup on local disk.
backup_files="/Users/michaelmcmillan/Prosjekter"
# Where to backup to in Google Drive.
dest="xxxxxxxxx"
# Create archive filename.
day=$(date +%Y-%m-%d:%H:%M)
hostname=$(hostname -s)
archive_file="$hostname-$day.tgz"
# Backup the files using tar and piping it to Google Drive.
tar czfP - $backup_files | $DRIVE upload --stdin --title $archive_file --parent $dest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment