Posted by Jamila on 05/02/2011 - 5:53pm
Today I successfully set up backing up all of our company's Google Documents to our own server in OpenOffice formats. Here's how I did it.
I started by making sure I had Python installed (2.6+), then cd'd to /usr/local/lib/python2.6/dist-packages, creating it if necessary.
then I downloaded gdata-python-client and gdatacopier.
http://code.google.com/p/gdata-python-client/ - On this site you want the file called gdata-version#.tar.gz or gdata-version#.zip, it's under Featured Downloads in the right sidebar
http://code.google.com/p/gdatacopier/ - On this site you want the file called gdatacopier-version#.tgz
Extract both packages.
Go into the gdata directory.
Install the script.
Now go into the gdatacopier directory
And make all the scripts there executable.
Congratulations! Now it's installed!
You can test it out.
For example his command will put a copy of all (/all) of your files into your home directory
that have updated (-u option) since the last time you ran the script, overwrite the old files (-o),
and create directories for all your files based upon who created them (-c).
The default is to download them all as OpenOffice format. (support FLOSS!)
It'll ask you for your password, and then show you all the files as it downloads.
Here's how I use it.
I created a script that I put in /etc/Cron.daily that will do all of this for me, every day.
I created a read-only file, with only root access, called gdocs in /etc, that has my password,
and the script reads the password from that file.
I'd be happy to learn of a more secure way to do this.
My bash script looks like this:
#!/bin/sh # This script backs up all Google docs at the account specified, # then sends an email to the specified email address. #path to wherever the gdata folder is export PYTHONPATH=/usr/local/lib/python2.6/dist-packages # command to get all items in username@gmail.com's Google Docs account that have been # updated since the last time the script was run, overwrite old files, # and create directories sorting documents by the name of their creator, # placing all in the home directory ~/ # then sending notification email to youremailaddress@you.com /usr/local/lib/python2.6/dist-packages/gdatacopier-2.1.2/gcp.py -o -u -c --password-file=/etc/gdocs username@gmail.com:/all ~/ | mail -s "Google Docs backup" youremailaddress@you.comThis bash script runs the gcp.py python script, and then pipes the output to mail, and sends it off to my email address.
You have to tell the script where the gdata folder is located, and that's what the export PYTHONPATH line is for.
Hope this helps everybody.
I got help from:
-jamila

Comments
Permalink
Thanks much for this article. I've been looking for a realiable way to backup google docs on a linux machine for awhile. This works incredilbly well. I had been using GDocBackup which fails on some documents for no apparent reason.
Permalink
Glad it helped Bob!
I just updated the post to reflect the process for Debian Squeeze with the latest version of Python and the latest version of gdata-python-client.
Permalink
Wow, this article is a treasure! I'm dealing only with google docs in a company which I work for and we use Linux, so the problem of back-uping documents is greatly actrual for me. Thanks again!
Permalink
Thanks so much for this how-to! I was getting increasingly concerned about some of the docs I have on Google, most of which are redundant, but many of which aren't. A lifesaver!
Add new comment