Backup Google Drive / Docs

google-drive
Cloud storage is often used for backup, but finding myself relying more and more on cloud-only documents, I felt a need for backup in the opposite direction: backing up my entire Google Drive to local storage – preserving the folder hierarchy. I was not able to find a script that does this, so I wrote one myself. I chose to do it in bash, making use of the Python scripts of the previous post.

The main challenges were:

- Characters in file names: My script can handle any number of slashes and spaces in file names, but only single spaces in folder names.

- Multiple parent folders: When an already downloaded file appears again, a soft link is created to the already downloaded file. Could be a hard link instead – easy to change.

Downloads:

Installation:

  • download and install gdata-2.0.14
  • download and place the above python scripts somewhere on your $PATH
  • make all scripts executable
  • customize the local backup directory in backup_google_docs.sh
  • for convenience: hard-code your Google email address in backup_google_docs.sh

Now just execute backup_google_docs.sh and watch your Google Drive being downloaded.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>