linuxfile-uploadcommand-linedrive

How to update local files to Google Drive using command line Linux


I am new to Linux and I want to upload/update my local files to Google Drive automatically using the Linux command. Does someone have experience before? Appreciate it if someone can provide me with my resources/step by step to do it. Thanks.


Solution

  • Here's a basic approach, just tested it so it should work.

    1. Get gdrive, maybe it's already available in your distribution's repo, if not download the latest release or build it from source.

    2. Now we will need to give access to Google Drive to allow this program to connect to your account. To do this, insert below command. The program will ask for a Google Client ID and Client Secret, it will also give a link to a page explaining how to get those two informations.

     gdrive account add
    
    1. Now we are done... Let's upload a file.
     gdrive upload /file_path  
    

    For example,

     gdrive files upload /opt/subhash.txt  
    
    1. Go to google drive and check it's uploaded.