drive-google mounting Google Drive using Go

Mount Google Drive like a network drive to your PC using https://github.com/odeke-em/drive.   This is more useful than the forced instant bidirectional sync of the primary Google Drive client, Facebook, etc.

Install (one-time)

  1. make a place to put your drive-google go files (assuming you haven’t already).  Edit ~/.bashrc adding the lines:

    export GOPATH=$HOME/gopath
    export PATH=$PATH:$GOPATH:$GOPATH/bin
    
  2. close/reopen terminal
  3. go get -u github.com/odeke-em/drive/cmd/drive

mount Google Drive to directory ~/gdrive

drive init ~/gdrive

List files in Google Drive

drive list [path]

to list matching files e.g. avi

drive list --matches avi

Create Google Drive folder

drive new --folder mynewfolder

Pull files

(like rsync TO your PC FROM Google Drive, will delete local files not on Google Drive)

globbing optional

drive pull path/to/pull/*.ext

Push files

(like rsync FROM your PC TO Google Drive)–globbing optional

drive push path/to/push/*.docx

Copy files

(like scp FROM your PC TO Google Drive)–globbing optional

drive push --destination my/remote/path my/local/path

Unmount Google Drive

drive deinit

Please see the README, there are numerous more functions and options.

 

Useful options

-no-clobber  only update non-existing files, not files that have merely changes

-no-prompt  careful! will not ask before download/upload

Leave a Comment