Hack for Archiving Google Drive

Problem: Archiving of Google Drive documents does not work with the google drive app. Why? Google Drive App stores only links to the cloud (i.e. .gdoc, .gsheet).
Solution: Write a script and use a cron job 🙂

which gdrive >/dev/null || echo "Missing gdrive. Get it here: https://github.com/prasmussen/gdrive"
_archive_filetype ()
find "$google_drive_dir" -name "*.$from" -print0 | while read -d $'\0' file
id=$(sed 's/.*"doc_id": "//;s/".*//' "$file")
bd=$(dirname "$file")
cd "$bd"
gdrive download --id $id --format "$to" --force

_archive_filetype gdoc docx
_archive_filetype gslides pdf
_archive_filetype gsheet xlsx


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 )

Google photo

You are commenting using your Google 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