How To Upload Files To One Drive Command Line
I've been looking at several linux projects here recently, such equally LibreNMS, and you'll demand to exist sure you are backing them up. I wanted to apace backup a compressed copy 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, non to exist mistaken for Google Drive itself, is a command line tool past Petter Rasmussen for Linux, Windows and OSX. Only what I needed. It'south proved itself so 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 run across a file in your home 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
- You'll demand to tell Google Drive to allow this plan to connect to your account. To exercise this, run the gdrive program with any parameter and copy the text it gives you to your browser. Then paste in to your SSH window the response lawmaking that Google gives y'all.Run the post-obit.
- YOU ARE DONE! Now you can upload files every bit 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 folder
copy downloads \ gdrive - windows - x64 . exe c : \ windows
- Run gdrive with a parameter to become the Google hallmark code and and so copy that to a browser windows. Paste back the verification code.
- Now upload a file. WOOOT!
gdrive - windows - x64 . exe upload c : \ exam \ backup . zip
Common Switches
GDrive supports a load of useful features which yous should accept 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 get access token ( for advanced users) --admission-token <accessToken> Oauth access token, just recommended for short-lived requests because of short lifetime ( for advanced 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 --name <proper name> Filename --no-progress Hide progress --mime <mime> Force mime type -- share Share file --deleteDelete local file when upload is successful --chunksize <chunksize> Prepare chunk 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 get access token ( for advanced users) --access-tokenOauth access token, simply recommended for short-lived requests considering of short lifetime ( for advanced users) options : -f, --strength Overwrite existing file -r, --recursive Download directory recursively, documents will be 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, --configApplication path , default: /Users/ / .gdrive --refresh-tokenOauth refresh token used to become access token ( for avant-garde users) --admission-tokenOauth access token, only recommended for brusk-lived requests because of brusque lifetime ( for advanced users) options : -thou, --maxMax files to list, default: 30 -q, --query Default query: "trashed = false and 'me' in owners" . See https: / /developers.google.com/bulldoze/search-parameters --order Sort order. Run across https: / /godoc.org/google.golang.org/api/bulldoze/v3#FilesListCall.OrderBy --proper noun-widthWidth of proper noun column, default: 40, minimum: 9, use 0 for total width --absolute Evidence absolute path to file (will merely bear witness path from first 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 get access token ( for advanced users) --access-tokenOauth access token, only recommended for short-lived requests because of curt lifetime ( for advanced users) options : --part Share role: owner/writer/commenter/reader, default: reader -- type Share blazon : user/grouping/domain/anyone, default: anyone --emailThe email accost of the user or grouping to share the file with. Requires 'user' or 'group' as type --discoverableMake file discoverable past search engines --revokeDelete all sharing permissions (owner roles volition be skipped) |
How To Upload Files To One Drive Command Line,
Source: http://olivermarshall.net/how-to-upload-a-file-to-google-drive-from-the-command-line/
Posted by: wrighthimered.blogspot.com
0 Response to "How To Upload Files To One Drive Command Line"
Post a Comment