Upload to Google Docs From Unix Terminal
I've been looking at several linux projects here recently, such every bit LibreNMS, and you'll need to be certain y'all are backing them upwardly. I wanted to speedily backup a compressed copy of my LibreNMS install and and then I went looking for a super easy mode to upload a file to Google Drive, and I establish it with gdrive.
gdrive, not to exist mistaken for Google Drive itself, is a command line tool past Petter Rasmussen for Linux, Windows and OSX. Merely what I needed. Information technology's proved itself and then useful that I can'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&export=download
- You should see a file in your dwelling house directory called something list uc=0B3X9GlR6EmbnWksyTEtCM0VfaFE. Rename this file to gdrive.
mv uc \ ? id \ = 0B3X9GlR6EmbnWksyTEtCM0VfaFE gdrive
- Assign this file executable rights.
- Install the file to your usr folder.
sudo install gdrive / usr / local / bin / gdrive
- Y'all'll demand to tell Google Drive to let this programme to connect to your business relationship. To practice this, run the gdrive programme with whatever parameter and re-create the text it gives y'all to your browser. Then paste in to your SSH window the response code that Google gives y'all.Run the following.
- YOU ARE DONE! Now y'all tin upload files as required.
gdrive upload backups . tar . gz
Windows
- Download the Windows version of gdrive from github.
- Copy 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 dorsum the verification code.
- Now upload a file. WOOOT!
gdrive - windows - x64 . exe upload c : \ test \ fill-in . zero
Mutual Switches
GDrive supports a load of useful features which you should take a look at. The follow are grabbed from the gDrive page at git.com.
Upload file or directory
| gdrive [global] upload [options] < path > global : -c, --config <configDir> Application path , default: /Users/ <user> / .gdrive --refresh-token <refreshToken> Oauth refresh token used to go access token ( for advanced users) --admission-token <accessToken> Oauth access token, only recommended for brusk-lived requests considering of short lifetime ( for avant-garde users) options : -r, --recursive Upload directory recursively -p, --parent <parent> Parent id, used to upload file to a specific directory, can be specified multiple times to give many parents --proper name <name> Filename --no-progress Hide progress --mime <mime> Force mime type -- share Share file --deleteDelete local file when upload is successful --chunksize <chunksize> Ready clamper size in bytes, default: 8388608 |
Download file or directory
| gdrive [global] download [options] global : -c, --configApplication path , default: /Users/ / .gdrive --refresh-tokenOauth refresh token used to become admission token ( for advanced users) --access-tokenOauth access token, only recommended for curt-lived requests because of brusk 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 Hibernate progress --stdoutWrite file content to stdout |
List files
| gdrive [global] listing [options] global : -c, --configAwarding path , default: /Users/ / .gdrive --refresh-tokenOauth refresh token used to get access token ( for advanced users) --access-tokenOauth access token, only recommended for short-lived requests because of short lifetime ( for advanced users) options : -m, --maxMax files to list, default: 30 -q, --query Default query: "trashed = false and 'me' in owners" . Run into https: / /developers.google.com/drive/search-parameters --social club Sort order. See https: / /godoc.org/google.golang.org/api/drive/v3#FilesListCall.OrderBy --name-widthWidth of proper name column, default: 40, minimum: 9, use 0 for full width --accented Testify absolute path to file (volition just show path from get-go parent) --no-headerDont print the header --bytesSize in bytes |
Share file or directory
| gdrive [global] share [options] global : -c, --configApplication path , default: /Users/ / .gdrive --refresh-tokenOauth refresh token used to go access token ( for avant-garde users) --access-tokenOauth access token, only recommended for short-lived requests considering of short lifetime ( for avant-garde users) options : --role Share role: owner/writer/commenter/reader, default: reader -- type Share type : user/group/domain/anyone, default: anyone --electronic mailThe email address of the user or grouping to share the file with. Requires 'user' or 'grouping' as type --discoverableBrand file discoverable past search engines --revokeDelete all sharing permissions (owner roles will be skipped) |
Source: https://olivermarshall.net/how-to-upload-a-file-to-google-drive-from-the-command-line/
0 Response to "Upload to Google Docs From Unix Terminal"
Postar um comentário