Created
July 16, 2014 23:54
-
-
Save peterchester/b917913c04ce1ee9e0e5 to your computer and use it in GitHub Desktop.
Bash script for backing up selected google docs on a mounted google drive. Copies the files to new files with "BACKUP YYYY-MM-DD" added to the file name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Google Drive path | |
BASEDIR='/Users/xxxx/Google Drive/' | |
# Files to backup | |
FILES=( | |
'Some Folder on Your Drive/Some Spreadsheet.gsheet' | |
'Some Other Folder on Your Drive/Some Doc.gdoc' | |
) | |
# Date appended to the file to mark it as a backup. | |
DATE=$(date '+%Y-%m-%d') | |
# Loop through files to back them up. | |
for i in "${FILES[@]}"; do | |
ORIGINALPATH="$BASEDIR$i" | |
BAREPATH=${ORIGINALPATH%.*} | |
EXTN=${ORIGINALPATH##$BAREPATH} | |
BACKUPPATH="$BAREPATH BACKUP $DATE$EXTN" | |
cp "$ORIGINALPATH" "$BACKUPPATH" | |
echo "Backup Complete: $BACKUPPATH" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe I'm missing something, but are you aware that .gsheet, .gdoc etc are just pointers to the files online? Look in those actual files and inspect the contents? I don't think this backup will help you much if Google Docs disappears/goes down.