Monday, July 16, 2012

Mini How-to : Google Drive under Linux: Synchronize your Google Drive under Linux with grive ! (waiting for the official Google client ^^)



Edit 10/18/2012:
Take a look at new project https://www.insynchq.com/, it's very easy to install and use, offers much more integration in Linux desktop than grive.

Very great !!!



Official Linux Google drive version is still lacking... if you are as i am addicted to various Google Services this lack is very frustrating ! (what does Google waits for ???)

Fortunately, you can now, thanks to "grive" and its author, synchronize your local documents to your Google Drive in command line :-)

Here's how in a few command lines:

Install grive:

Install grive (under Ubuntu and derived distributions)

sudo add-apt-repository ppa:nilarimogard/webupd8

sudo apt-get update

sudo apt-get install grive

Configure first launch to authorize grive to access to your Google Drive:

Go to the directory you to be synchronize with Google Drive and configure grive

$ cd <My Local Directory to synchronize>
$ grive
-----------------------                                                                                                                     
Please go to this URL and get an authentication code:                                                                                       
                                                                                                                                            
https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2F
auth%2Fuserinfo.profile+https%3A%2F%2Fdocs.google.com%2Ffeeds%2F+https%3A%2F%2Fdocs.googleusercontent.com%2F+https%3A%2F%2Fspreadsheets.goog
le.com%2Ffeeds%2F&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&client_id=22314510474.apps.googleusercontent.com                
                                                                                                                                            
-----------------------                                                                                                                     
Please input the authentication code here:   


Open your Web browser, paste this URL and login with your Google account when asked and finally copy the code that Google will provide to paste into the terminal

grive will execute the first synchronization:

Reading local directories
Synchronizing folders
Reading remote server file list
Detecting changes from last sync
Synchronizing files
Finished!  


You're done, now every time you want to synchronize your local data with your Google Drive, just enter a terminal, "cd" to your directory and enter "grive" command line.

It is not necessary anymore to run it with "-a" option as its purpose was to configure and associate your computer with your Google drive account, just run grive with no option to initiate synchronization.

You may also want to see others options such as "-v" to enable more verbose mode or "--dry-run" to simulate execution, just see help:

grive --help                                                                                                         
Grive options:                                                                                                                              
  -h [ --help ]         Produce help message                                                                                                
  -v [ --version ]      Display Grive version                                                                                               
  -a [ --auth ]         Request authorization token                                                                                         
  -V [ --verbose ]      Verbose mode. Enable more messages than normal.                                                                     
  -d [ --debug ]        Enable debug level messages. Implies -v.                                                                            
  -l [ --log ] arg      Set log output filename.                                                                                            
  -f [ --force ]        Force grive to always download a file from Google Drive                                                             
                        instead of uploading it.                                                                                            
  --dry-run             Only detect which files need to be uploaded/downloaded,                                                             
                        without actually performing them.  



Really great work from the author (see man):

AUTHOR                                                                                                                                      
       The software was developed by Nestal Wan.                                                                                            
                                                                                                                                            
       This manpage was written by Jose Luis Segura Lucas (josel.segura@gmx.es)   


  
Now we (all Linux Google services users) are still waiting from Google to finally provide us their official client... Google listen to us, it would be nice not to forgive Linux users :-)