Posted 05.02.2011 by Jamila
cd /usr/local/lib/python2.6/dist-packages
wget http://gdata-python-client.googlecode.com/files/gdata-2.0.16.tar.gz
wget http://gdatacopier.googlecode.com/files/gdatacopier-2.1.2.tgz
tar xzvf gdata-2.0.16.tar.gz
tar xzvf gdatacopier-2.1.2.tgz
cd gdata-2.0.16
sudo python setup.py install
cd ..
cd gdatacopier-2.1.2
chmod 755 ./*.*
./gcp.py -o -u -c username [at] gmail.com:/all ~/
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 [at] 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 [at] you.com
/usr/local/lib/python2.6/dist-packages/gdatacopier-2.1.2/gcp.py -o -u -c --password-file=/etc/gdocs username [at] gmail.com:/all ~/ | mail -s "Google Docs backup" youremailaddress [at] you.com
This 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