Mark R Lindsey

Backups for Google Docs

In Uncategorized on October 12, 2009 at 9:14 pm

Google Documents is really nice; it’s not exactly a MS Word replacement, but it’s still very useful, especially as a collaboration tool.

You can manually export a document from GDocs. But I can’t easily, consistently, reliably (i.e., automatically) back it up. If Google docs is down for the week, or if they decide to cancel the service years from now, then I might lose access to all the work I’ve put into Google docs.

On October 1, Devraj Mukherjee released gdatacopier 2.0. (I was actually the fourth downloader EVER! Yay! This one is definitely going in my Golden Book of Memories.)

gdatacopier was developed by a consulting company, and the client, De Bertoli Wines, allowed it to be open sourced.

What is it?

gdatacopier is a pair of python scripts to list and copy files from Google Docs to your local filesystem. It supports wildcards, too. For example:


./gcp.py -o -f pdf -u -p markspassword usernamehere@gmail.com:/* $HOME

…makes a PDF backup of all of my Google Documents, in PDF format, to my home directory. It only updates files that have changed in Google docs since the last download.

Want other formats? Use “doc”, “xls”, “ppt”, “html”, “oo” (for openoffice) instead of “pdf.”

And if I can see a document, then I can download it. So if you share a document with me, * will grab it automatically.

Automated download script

I will have a download job that backs up all of my Google documents. It’ll be something like the one shown below. The idea is to extract every file in lots of different file formats; hopefully one of them will be useful years hence.


#!/bin/sh -
##
BACKUP_DIR=$HOME/Documents/google_docs_backup
USERNAME="usernamehere@gmail.com"
PASSWORD="marksPASSWORD"
##
mkdir -p $BACKUP_DIR
##
for format in doc xls html pdf ppt tsv csv zip rtf txt odt ods
do
##
## If the particular format isn't appropriate for the particular
## document, then gcp defaults to the open office format.
##
gcp.py -o -f ${format} -u -p $PASSWORD $USERNAME:/* $BACKUP_DIR
done
##
## End of google docs backup script

Save this as “$HOME/backup_google_docs”. Then set the permission to executable (e.g., “chmod 755 $HOME/backup_google_docs”).

Then you can add this to your crontab; e.g., add a line like this:


0 2 * * * $HOME/backup_google_docs
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: