Step-by-step guide to using "drive" (a google drive push/pull client written in "go" and preinstalled in /sw/crontrib/go on Hyak/Mox. Note: Needs a build node for internet access

Step 1:  (one time) Set up your User environment to add the /sw/contrib/go area to your $PATH variable:

 

  1. start an interactive session on a build node on Mox:

salloc -p build srun --pty bash

2. add these paths to your ~/.bashrc (or just export them, you might not even need all of them):


export PATH=$PATH:/sw/contrib
export PATH=$PATH:/sw/contrib/go/bin
export GOPATH=/sw/contrib/go/

 

3. Log out and back in again to re-read the .bashrc

4. Run "drive" to see this output:

[mbw@n2163 go]$
[mbw@n2163 go]$ drive
Usage: drive <command>

where <command> is one of:
about print out information about your Google drive
clashes fix clashes by renaming or trashing all files
copy copy remote paths to a destination
cp copy remote paths to a destination
deinit removes the user's credentials and initialized files
del deletes the items permanently. This operation is irreversible
delete deletes the items permanently. This operation is irreversible
diff compares local files with their remote equivalent
du similar to util `du` gives you disk usage
edit-desc edit the attributes of a file
edit-description edit the attributes of a file
emptytrash permanently cleans out your trash
features returns information about the features of your drive
file-id retrieve the fileId for the specified paths
help Get help for a topic
id retrieve the fileId for the specified paths
index fetch indices from remote
init initializes a directory and authenticates user
issue report an issue to the project's issue tracker
list lists the contents of remote path
ls lists the contents of remote path
md5sum prints a list compatible with md5sum(1)
move move files/folders
mv move files/folders
new create a new file/folder
open open a file in the appropriate filemanager or default browser
pub publishes a file and prints its publicly available url
pull pulls remote changes from Google Drive
push push local changes to Google Drive
qr open up the QR code for specified files
quota prints out information related to your quota space
rename renames a file/folder
report report an issue to the project's issue tracker
report-issue report an issue to the project's issue tracker
share share files with specific emails giving the specified users specifies roles and permissions
star star files
stat display information about a file
touch updates a remote file's modification time to that currently on the server
trash moves files to trash
unpub revokes public access to a file
unshare revoke a user's access to a file
unstar unstar files
untrash restores files from trash to their original locations
url returns the remote URL of each file
version 0.3.9.1

drive <command> -h for subcommand help

 

Step 2: (one time)

Create/find & "cd" to a directory where you have disk space and permissions (such as /gscratch/teamname/yournetid )

mkdir  /gscratch/${SLURM_JOB_ACCOUNT}/${USER}

cd /gscratch/${SLURM_JOB_ACCOUNT}/${USER}

Step 3: Set up your connection between google drive and your local directory:

[mbw@n2163 go]$ drive init


(follow directions to set up connection between the current directory and whichever google drive account you want to use)

then you should be able to run "drive" plus commands like push and pull, etc

 

 

You should be able to have multiple unix folders that are connected to different google drives...

heres what you do for a UW Google drive (personal or shared uwnetid based)
1) Get a browser ready on your desktop machine (could be a completely different computer than used for Hyak, buy you will enjoy being able to copy/paste a long link URL)

1.5) close completely chrome and open a fresh instance (not a fresh window - you want a browser not logged in to UW weblogin) 
2) go to uwnetid.washington.edu and log in as the uwnetid whose google drive account you wish to use. 
3) Now go back to hyak connection shell on build node.  cd in to the directory you want to do this google drive sync with
4) run 'drive init'
5) Take the URL and paste it in to the chrome window where you are logged in already as the uwnetid you want 

then the login should take you to the right place in the google world.

Whatever UWNETID your browser window where you paste the URL from hyak, that is the google account/drive you will be connecting to.

Once the connection is established, it is stored in .dotfiles in the directory that the go "drive" client can find an refernce.

 

 

 

The "go" binary "drive" comes from the following github page:

https://github.com/odeke-em/drive

 

It was compiled in October 2017 by nsmack and placed in /sw/contrib/go

 

 

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.