Difference between revisions of "GDrive"
Johnbullard (talk | contribs) |
Johnbullard (talk | contribs) |
||
Line 67: | Line 67: | ||
===GDrive commands=== | ===GDrive commands=== | ||
− | You can get a full list of available commands by typing "'''gdrive help'''" but the most common ones are: | + | You can get a full list of available commands by typing "'''gdrive help'''" but example of the most common ones are: |
− | List | + | ====List files currently in your Google Drive:==== |
gdrive list | gdrive list | ||
− | Upload a file to your Google Drive: | + | ====Upload a file to your Google Drive:==== |
gdrive upload /orange/yourgroup/yourusername/mydata/somefile.dat | gdrive upload /orange/yourgroup/yourusername/mydata/somefile.dat | ||
− | Upload an entire directory to your Google Drive: | + | ====Upload an entire directory to your Google Drive:==== |
gdrive upload --recursive /orange/yourgroup/yourusername/mydata/ | gdrive upload --recursive /orange/yourgroup/yourusername/mydata/ | ||
− | Download a file from your Google Drive to a specific directory: | + | ====Download a file from your Google Drive to a specific directory:==== |
gdrive download --path /orange/yourgroup/yourusername/mydata/ 1PrZieajI6P6ikl1zk1Zn4zRhXZMOhoDg | gdrive download --path /orange/yourgroup/yourusername/mydata/ 1PrZieajI6P6ikl1zk1Zn4zRhXZMOhoDg | ||
− | + | or | |
− | gdrive | + | gdrive download query --path /orange/yourgroup/yourusername/mydata/ somefile.dat |
Line 127: | Line 127: | ||
See the [[{{PAGENAME}}_Install]] page for {{#var: app}} installation notes.|}} | See the [[{{PAGENAME}}_Install]] page for {{#var: app}} installation notes.|}} | ||
<!--Turn the Table of Contents and Edit paragraph links ON/OFF--> | <!--Turn the Table of Contents and Edit paragraph links ON/OFF--> | ||
− | + | __NOEDITSECTION__ |
Revision as of 17:51, 3 August 2021
Description
gdrive is a command line utility for interacting with Google Drive. You can use this utility to transfer files between the HiPerGator environment and your UF-provided Google Drive storage.
Environment Modules
Run module spider GDrive
to find out what environment modules are available for this application.
System Variables
- HPC_GDRIVE_DIR - installation directory
- HPC_GDRIVE_BIN - executable directory
Additional Information
Initial authentication and authorization
Before using GDrive from the HiPerGator environment, you must give it permission to access your Googe Drive. Do that by following the steps below.
- Load the module and then initiate authentication using "gdrive about":
$ module load gdrive/2.1.0 $ gdrive about
- If authentication is needed (e.g. it is your first time using the module or your prior authentication has expired), you will then get the following prompt:
Authentication needed Go to the following url in your browser: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=... Enter verification code:
- Copy and paste the supplied URL into a browser on your desktop.
- In that browser, log into your UF Google account using your UF credentials.
- You will then be prompted that "project-367116221053 wants to access your Google Account...See, edit, create, and delete all of your Google Drive files". Read the note below and, if you are comfortable with this, click [Allow].
- After allowing permissions, you will be taken to a page with an authorization code on it. Copy that code and paste it back in your HiPerGator session where it is waiting at the "Enter verification code:" prompt.
- You should now be able you access your Google drive using gdrive commands (i.e. try "gdrive list" to show the files currently in your Google Drive).
GDrive commands
You can get a full list of available commands by typing "gdrive help" but example of the most common ones are:
List files currently in your Google Drive:
gdrive list
Upload a file to your Google Drive:
gdrive upload /orange/yourgroup/yourusername/mydata/somefile.dat
Upload an entire directory to your Google Drive:
gdrive upload --recursive /orange/yourgroup/yourusername/mydata/
Download a file from your Google Drive to a specific directory:
gdrive download --path /orange/yourgroup/yourusername/mydata/ 1PrZieajI6P6ikl1zk1Zn4zRhXZMOhoDg
or
gdrive download query --path /orange/yourgroup/yourusername/mydata/ somefile.dat
Revoking Access
When you perform the initial authentication and authorization steps above, the program creates access tokens in your home directory as:
/home/yourusername/.gdrive/
You can immediately revoke access at any time by removing that directory:
rm -rf /home/yourusername/.gdrive/