Command Line Upload Google Drive Raspberry Pi
How to upload a file to Google Drive from the command line
I've been looking at several linux projects here recently, such as LibreNMS, and you'll need to be sure you lot are bankroll them upwardly. I wanted to rapidly fill-in a compressed re-create of my LibreNMS install and so I went looking for a super piece of cake style to upload a file to Google Drive, and I found it with gdrive.
gdrive, not to be mistaken for Google Drive itself, is a command line tool by Petter Rasmussen for Linux, Windows and OSX. Just what I needed. Information technology's proved itself and then useful that I tin't imagine how I lived without it.
Linux
- SSH on to your linux box and download the Linux version of gdrive from GitHub.
cd ~
wget https : //docs.google.com/uc?id=0B3X9GlR6EmbnWksyTEtCM0VfaFE&consign=download
- You should run across a file in your home directory called something listuc=0B3X9GlR6EmbnWksyTEtCM0VfaFE. Rename this file to gdrive.
mv uc \ ? id \ = 0B3X9GlR6EmbnWksyTEtCM0VfaFE gdrive
- Assign this file executable rights.
- Install the file to your usr binder.
sudo install gdrive / usr / local / bin / gdrive
- Yous'll demand to tell Google Bulldoze to allow this program to connect to your business relationship. To practise this, run the gdrive plan with any parameter and copy the text information technology gives you to your browser. Then paste in to your SSH window the response code that Google gives yous.Run the following.
- Y'all ARE Done! Now yous can upload files as required.
gdrive upload backups . tar . gz
Windows
- Download the Windows version of gdrive from github.
- Re-create the gdrive-windows-x64.exe file to your c:\windows binder
copy downloads \ gdrive – windows – x64 . exe c : \ windows
- Run gdrive with a parameter to get the Google authentication code and then copy that to a browser windows. Paste back the verification code.
- Now upload a file. WOOOT!
gdrive – windows – x64 . exe upload c : \ examination \ fill-in . zippo
Common Switches
GDrive supports a load of useful features which you lot should take a await at. The follow are grabbed from the gDrive page at git.com.
Upload file or directory
1 2 3 4 five vi 7 viii 9 10 eleven 12 thirteen 14 fifteen 16 | gdrive [global] upload [options] < path > global : –c, —config <configDir> Application path , default: /Users/ <user> / .gdrive —refresh–token <refreshToken> Oauth refresh token used to get admission token ( for avant-garde users) —access–token <accessToken> Oauth access token, only recommended for short–lived requests because of curt lifetime ( for advanced users) options : –r, —recursive Upload directory recursively –p, —parent <parent> Parent id, used to upload file to a specific directory, tin be specified multiple times to give many parents —name <name> Filename —no–progress Hibernate progress —mime <mime> Strength mime type — share Share file —deleteDelete local file when upload is successful —chunksize <chunksize> Ready chunk size in bytes, default: 8388608 |
Download file or directory
1 2 3 4 v half-dozen 7 eight nine 10 11 12 13 fourteen | gdrive [global] download [options] global : –c, —configAwarding path , default: /Users/ / .gdrive —refresh–tokenOauth refresh token used to go admission token ( for advanced users) —admission–tokenOauth access token, only recommended for brusk–lived requests because of short lifetime ( for avant-garde users) options : –f, —forcefulness Overwrite existing file –r, —recursive Download directory recursively, documents will exist skipped — path Download path —deleteDelete remote file when download is successful —no–progress Hide progress —stdoutWrite file content to stdout |
List files
1 2 3 4 v six 7 8 9 ten 11 12 13 14 fifteen | gdrive [global] list [options] global : –c, —configApplication path , default: /Users/ / .gdrive —refresh–tokenOauth refresh token used to get admission token ( for advanced users) —access–tokenOauth access token, only recommended for brusque–lived requests because of short lifetime ( for advanced users) options : –m, —maxMax files to list, default: xxx –q, —query Default query: "trashed = simulated and 'me' in owners" . See https: / /developers.google.com/drive/search–parameters —lodge Sort order. Encounter https: / /godoc.org/google.golang.org/api/bulldoze/v3#FilesListCall.OrderBy —name–widthWidth of name column, default: xl, minimum: ix, use 0 for total width —absolute Testify absolute path to file (will only show path from first parent) —no–headerDont print the header —bytesSize in bytes |
Share file or directory
one 2 3 4 5 6 7 8 9 10 xi 12 13 | gdrive [global] share [options] global : –c, —configApplication path , default: /Users/ / .gdrive —refresh–tokenOauth refresh token used to get access token ( for advanced users) —access–tokenOauth access token, simply recommended for short–lived requests because of brusque lifetime ( for advanced users) options : —role Share role: owner/author/commenter/reader, default: reader — type Share type : user/group/domain/anyone, default: anyone —e-mailThe e-mail address of the user or grouping to share the file with. Requires 'user' or 'group' as type —discoverableMake file discoverable by search engines —revokeDelete all sharing permissions (owner roles will be skipped) |
Source: https://wp.huangshiyang.com/how-to-upload-a-file-to-google-drive-from-the-command-line
0 Response to "Command Line Upload Google Drive Raspberry Pi"
Enregistrer un commentaire