Skip to content

Instantly share code, notes, and snippets.

@ben-gy
Last active October 3, 2016 06:21
Show Gist options
  • Save ben-gy/ff836bd02b934078001d3c7449ca6af0 to your computer and use it in GitHub Desktop.
Save ben-gy/ff836bd02b934078001d3c7449ca6af0 to your computer and use it in GitHub Desktop.
  1. Open terminal
  2. Drop the folder where you want to keep the script in the terminal window
  3. Type "touch backup_script" and hit enter

Now, every time you want to run a backup, open your terminal and drop the script into the window and hit enter.

nb// the folder locations are hardcoded and it's not automatic (run it manually each day)

#!/bin/bash

echo Hey Will, copying your files now...

TIME=`date +%b-%d-%y`
FILENAME=backup-$TIME.tar.gz
SRCDIR=~/Google\ Drive/PwC
DESDIR=~/Documents/backups

tar -cpzf $DESDIR/$FILENAME "$SRCDIR"

echo Hey Will, all done...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment