Simple Backup Solution with Google Drive

Simple Backup Solution with Google Drive

ยท

2 min read

Everybody knows Google. A lot of us use their services including Google Drive. But did you know that there are command-line tools for Google Drive?

Several exist. The one I would recommend to you is github.com/SonnyAD/gdcp It is not maintained anymore by the original author, but it is pretty stable and my fork has some extra features for deletion and untrashing files.

To use it as a backup solution, follow first the instructions to set up here: github.com/SonnyAD/gdcp#setup FYI You only need to do that once.

Then you are good to go.

To upload a file to the root of your drive you can do:

gdcp upload $FILENAME

To upload a file into a folder foo, first get the ID of the folder:

$ gdcp list 
foo 0Bxt5Ia3JxzdHfkJDeUxCQ3RyaWp    folder

Then upload like that:

gdcp upload -p 0Bxt5Ia3JxzdHfkJDeUxCQ3RyaWp $FILENAME

-p means here parent folder.

Now that you are ready with gdcp, I invite you to write a script to go through your folders you want to back up and use it to upload the files or zipped version into your Google Drive.

For more details, check the documentation here: github.com/SonnyAD/gdcp


Photo by Elle Cartier on Unsplash

Did you find this article valuable?

Support Sonny Alves Dias by becoming a sponsor. Any amount is appreciated!

ย