Monday, October 12, 2009

Backups for Google Docs

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:

./ -o -f pdf -u -p markspassword* $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 -
mkdir -p $BACKUP_DIR
for format in doc xls html pdf ppt tsv csv zip rtf txt odt ods
## If the particular format isn't appropriate for the particular
## document, then gcp defaults to the open office format.
## -o -f ${format} -u -p $PASSWORD $USERNAME:/* $BACKUP_DIR
## 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

No comments: