prasmussen / gdrive Goto Github PK
View Code? Open in Web Editor NEWGoogle Drive CLI Client
License: MIT License
Google Drive CLI Client
License: MIT License
Hi. I was wondering how to use drive -a to change a google drive account.
drive -c doesn't seem to do anything but it may be because I have the wrong arguments.
Currently possible?
when i type:
gdrive list
all of my files are displayed except for excel/spreadsheets
Hi
Cannot pipe in a 5 MiB file and get it uploaded.
GDrive link
URL="https://drive.google.com/uc?id=0B3X9GlR6EmbnbGRXcWFWWWVOdTg"
curl $URL | gdrive/gdrive -c gdrive/conf upload -s -t "test.tmp"
wget $URL -O - | gdrive/gdrive -c gdrive/conf upload -s -t "test.tmp"
This is the error message I get when trying to upload a 500mb file.
An error occurred uploading the document: Post https://www.googleapis.com/upload/drive/v2/files?alt=json&uploadType=multipart: write tcp 74.125.28.95:443: broken pipe
How to get file or folder ID in remote path?
for example:
pi@PI:~$drive list --getId /RaspberryPi/Files
0b_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(↑↑↑Don't work,just example↑↑↑)
google drive allow same filename in a folder,when it occur:
pi@PI:~$drive list --getId /RaspberryPi/Files/123.txt
0b_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2015-02-13 11:22:33
0b_yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 2015-02-13 12:34:56
(↑↑↑Don't work,just example↑↑↑)
my english is not grate,please ignore my grammar problem.
For some reason, running list while querying against a parent ID (listing all files in that directory) even with a -m for max return value only returns 460 file entries... anything lower than 460 works properly, but nothing seems to work past it.
Or at least I can't see how to - how does this work?
Great little helper, I'm just missing a couple of details:
Also, the ability of uploading new versions of a file would be a great addition, as discussed in many other posts. This would allow us to use the versioning feature in Drive.
Thanks again
Hi
I just started using your binaries and I find it to be great. Just wanted to know if there is a provision to make multiple parents of an object being uploaded. I read somewhere that google drive gives this feature
$ echo "Hello World" | ./drive upload --stdin --title hello.txt
Id: 0B-9_enX9c21xNkRDRkowTGkwNDA
Title: untitled
Size: 12 B
Created: 2015-02-25 23:57:28
Modified: 2015-02-25 23:57:28
Owner: Carlos Garay
Md5sum: e59ff97941044f85df5297e1c302d260
Shared: False
Parents: 0AO9_enX9c21xUk9PVA
MIME Type:
Uploaded 'untitled' at 12 B/s, total 12 B
Using drive-linux-amd64 v1.5.0 on Ubuntu 14.04.1 LTS. Confirmed to also be a bug in Yosemite using drive-osx-amd64 v1.5.0
It would be great to be able to upload an entire folder at once.
Would it be possible to implement an option to overwrite existing files (both when downloading and uploading a file)?
Thank you for making this tool!
I've uploaded the apk file.
"C:\gdrive\drive-windows-386.exe" upload --file "C:\test.apk"
It seemed to be able to upload successfully. But, the file seems to be recognized as a zip file.
When I upload it manually, apk has been recognized correctly. I think it's a problem of this tool.
Thanks.
It would be great if a future version could support Files: emptyTrash, which could finally give us a method to automate trash cleanup. Thanks! -JW
gdrive can't create Drive client
root@radxa:/home# ./drive
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=367116221053-7n0vf5akeru7on6o2fjinrecpdoe99eg.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=state
Enter verification code: ---verification code here--
An error occurred creating Drive client: Post https://accounts.google.com/o/oauth2/token: EOF
root@radxa:/home#
is it possible to download by type just as you can in the web UI of google drive ?
If uploading a directory, it reuploads file that didn't change.
Would be better to check files already on server, compare their MD5 with local files,
upload only files that changed.
Thanks
Uploads that take longer than 1 hour (due to file size or limited bandwidth, or both) result in:
googleapi: Error 401: Invalid Credentials, authError
from code.google.com/p/google-api-go-client/drive/v2/drive-gen.go:3481, upon googleapi.CheckResponse(res)
.
My assumption is that Google is testing the expired-during-transit access_key upon completion of the POST rather than at the beginning.
I suppose this is a deliberate choice, but the fact that uploading a directory only uploads the files in it (and not the subdirectories) is rather inconvenient - especially since it's not made clear.
Ideally, there should be a recursive mode but, failing that, I think that the behavior should be explicit.
Basically, I'm facing the same issue as in #20. As I can clearly see within the last commit, the bugfix doesn't apply to stdin and only helps when directly specifying large files. As I need both a progress bar and some ratelimiting, I've created a bashscript which recursively uploads whole directories including all files. Also, I've implemented MD5 checksumming, so that those files won't get reuploaded.
The way I'm calling this application is like that: cat largefile | pv -pteraT -L <ratelimit> -s <totalfilesize> | ./gdrive upload -s -t <filename> -p <folderid>
. After quiet a few hours of uploading, it failed with "Error 401: Invalid credentials" as listed above. Could that fix also get implemented for uploading via stdin?
Dear developer,
This is very useful for all platform developers.
But progress bar is not found for download/upload.
Please provide this feature.
It's awesome work. Keep it up....
Uploading a big file (>20GB) to my Drive lead me to this error:
An error occurred uploading the document: Post https://www.googleapis.com/upload/drive/v2/files?alt=json&convert=false&uploadType=resumable&upload_id=CUT: dial tcp: lookup www.googleapis.com on 8.8.8.8:53: dial udp 8.8.8.8:53: too many open files
I have enough free space to upload the file and I use version 1.5.1 on ubuntu 14.04 amd64.
P.S. Am I the only one having lower uploading speed with latest version? ~1-2MB/s on a 100Mbit network.
Google drive provides file revision for up to 30 days,
could gdrive access those information and allow reverting to an older version ?
Also, if uploading a file with same name in the same directory, overwrite the old one instead of creating a new file.
Thanks
Hi
Great work, (I like cmd line!). Could you please add 'update' looks like it is possible with: https://developers.google.com/drive/v2/reference/files/update
I am not a go programmer!
Many thanks
I can't make the drive-linux-amd64 version (v1.6.1) pass the Google authentication step
$ wget 'https://drive.google.com/uc?id=0B3X9GlR6EmbnSWFxaExoUEk1NFk'
$ mv uc\?id\=0B3X9GlR6EmbnSWFxaExoUEk1NFk drive
$ chmod 700 drive
$ ./drive
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=<***client id here***>&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=state
Enter verification code:
<*** verification code from Google here ***>
An error occurred creating Drive client: OAuthError: updateToken: Unexpected HTTP status 400 Bad Request
$ lsb_release -a
LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
Am I doing anything wrong?
Hi prasmussen
C:\Windows\system32>gdrive list -q "title contains 'full'"
Id Title Size Created
0BxRXe4e5tCA0SlZNNWtnUEtJRUU FULL-(local)-smart_...0150225_030000.sqb 507 MB 2015-02-25 03:02:15
0BxRXe4e5tCA0ZGdpTGNhSkJCWTA FULL-(local)-smart_...0150224_030000.sqb 506 MB 2015-02-24 03:02:16
0BxRXe4e5tCA0dmFZZjlZdlljc2s FULL-(local)-smart_...0150223_030000.sqb 504 MB 2015-02-23 03:02:08
0BxRXe4e5tCA0SXlLcFZPU0huT1k FULL-(local)-smart_...0150222_030000.sqb 503 MB 2015-02-22 03:02:17
0BxRXe4e5tCA0M2VvMWp1WnJSQ0U FULL-(local)-smart_...0150221_030000.sqb 502 MB 2015-02-21 03:02:07
0BxRXe4e5tCA0TG1RNjNvZV9PNE0 FULL-(local)-smart_...0150220_030000.sqb 501 MB 2015-02-20 03:01:59
0BxRXe4e5tCA0M0d5djZtaEZkMFE FULL-(local)-smart_...0150219_030000.sqb 500 MB 2015-02-19 03:03:04
0BxRXe4e5tCA0eW8xU0lwbGRfRkU FULL-(local)-smart_...0150217_030000.sqb 499 MB 2015-02-17 03:01:56
C:\Windows\system32>gdrive list -q "title contains 'full'" -m 1
Id Title Size Created
please fix error
Thanks. Your tools are very excellent work backup. I love your gdrive tool.
Could you provide a version for armv5 ?
When I try "drive-linux-rpi v1.6.1" on my NAS (NSA325v2) I get "Illegal instruction (core dumped)"
Using "drive-linux-arm v1.6.1" I get "runtime: this CPU has no floating point hardware, so it cannot run
this GOARM=6 binary. Recompile using GOARM=5."
NSA325 uses a Marvell Kirkwood . Looking at arch linux, this is a armv5 platform.
Is is possible now to support files larger than 10GB?
I see in their Developer SDK site for Drive API v2 that it still says 10GB, but other sync clients such as insync support files larger than 10GB.
https://support.google.com/drive/answer/37603?hl=en
"Other files: Files that you upload but don’t convert to a Google Docs, Sheets, or Slides format can be up to 1TB each."
I would be so very happy if this great program could support files larger than 10GB.
In the mean time, loving it :)
Instead of aliasing gdrive, e.g.
alias gdrive="gdrive -c $XDG_CONFIG_HOME/gdrive"
It'll be nicer to have an environment variable to do that, e.g.
export GDRIVE_CONFIG_DIR="$XDG_CONFIG_HOME/gdrive"
Hi, could you add a command to return spaced used, free space, total space of the google drive ?
It would be great to add a check space left before uploading a large file,
or specify a min_free_space=500mb
so an upload doesn't fill all the space left ... because emails will bounce back if no more space.
P.S.
It would be usefull to have all filesize return in bytes with
list -b and info -b
Thanks and great work !
summary: 331 GiByte in 15h 42min 35.7sec - average of 6136 KiB/s
An error occurred uploading the document: googleapi: Error 401: Invalid Credentials, authError
kept getting this error when uploading large file
any suggestion?
How to distinguish an ID is a file or a folder?
Hello!
Thank you for this project. I have a problem, I am able to use the drive in a shell script, however when I set it as a cron job for the same user, it fails.
I have tried with custom config file and no changes..
Do you know how I might be able to debug it?
Thanks!
# go build drive.go
drive.go:5:2: cannot find package "github.com/prasmussen/gdrive/cli" in any of:
/usr/lib/go/src/pkg/github.com/prasmussen/gdrive/cli (from $GOROOT)
($GOPATH not set)
drive.go:6:2: cannot find package "github.com/prasmussen/gdrive/gdrive" in any of:
/usr/lib/go/src/pkg/github.com/prasmussen/gdrive/gdrive (from $GOROOT)
($GOPATH not set)
drive.go:7:2: cannot find package "github.com/prasmussen/gdrive/util" in any of:
/usr/lib/go/src/pkg/github.com/prasmussen/gdrive/util (from $GOROOT)
($GOPATH not set)
drive.go:8:2: cannot find package "github.com/voxelbrain/goptions" in any of:
/usr/lib/go/src/pkg/github.com/voxelbrain/goptions (from $GOROOT)
($GOPATH not set)
Could you help?
This is Debian backported go version go1.3.1 linux/amd64
Hey @prasmussen, very well done. I see great potential in this tool, but I couldn't find any documentation and my tests failed:
how would one upload a file into an existing directory?
My plan is to automate a build script and share the binarys in a public folder on my gdrive
Thanks and keep up the good work!
Great tool! Thanks for making this.
Can you add the option to enable OCR on a file upload?
I'm uploading 20 folders with the new folder option and it works really great!
I would like to use trickle to limit the upload bandwith but i saw it doesn't work with gdrive.
I run a command like this:
trickle -u 10 drive.go upload -p 0f4543fe2fdB8 -f /mnt/usb/
But it always use full upload bandwith.
Could you try and test it?
Thanks.
The gdrive list
command seems to never return more than 94 items (plus a one line header). Examples:
macbookpro:~ griscom$ gdrive list -q "title != 'lksdlkjsdfljkds'" | wc
95 790 10070
macbookpro:~ griscom$ gdrive list -q "title contains '0'" | wc
95 790 10070
macbookpro:~ griscom$ gdrive list -q "title contains 'xml'" | wc
31 191 3100
macbookpro:~ griscom$ gdrive list -q "title contains '1'" | wc
95 790 10070
macbookpro:~ griscom$ gdrive list | wc
95 790 10070
macbookpro:~ griscom$ gdrive list -q "title contains 'd'" | wc
95 790 10070
macbookpro:~ griscom$ gdrive list -q "title contains 'l'" | wc
95 790 10070
macbookpro:~ griscom$ gdrive list -q "title contains 'lksdflkj8833'" | wc
1 4 31
macbookpro:~ griscom$
Is this a Google Drive limitation, or something inside of gdrive?
When working with files we could not need to provide -i
with the id, it should be part of the args.
gdrive info -i aldksjfladskjf
gdrive info aldksjfladskjf
I'm not too familiar with the flags package that you are using. Do you know if the package supports taking args and populating the Options
struct?
Hi
When an error occurs, the exit code is still set to 0.
The error message is print but the program does not exit with none zero exit code. It can be read in the code:
Line 180 in af67666
The current behavior makes the following command to always output OK even when it should fail:
(gdrive/gdrive -c gdrive/conf upload -f tmp/* && echo OK) || echo FAIL
An error occurred uploading the document: googleapi: Error 403: The user has exceeded their Drive storage quota
OK
I just uploaded a folder with
gdrive-cli upload -f name\ folder/ -p 0123456789abcdef
Of the 7 files in folder, 2 are missing.
Is there a way to understand why? A log file, a verbose mode?
thanks
When I use upload
verb, it currently interprets slashes as it is rather than directory notation, so it makes a title with slashes in the root of the drive. I think it would be better if it supports uploading to folders.
Thanks for your great software!
Copying files is supported by the API (https://developers.google.com/drive/v2/reference/files/copy) but not by gdrive. It would be really useful, especially for working with drive only doc (eg gdoc).
Hi
Please add a cli parameter to delete the file from the local drive ( source ) upon successful upload
The download links for linux version do not contain extensions. In what format are they exactly in?
drive list -nq "'$fileid' in parents"
where $fileid
is the ID of a folder containing .gdoc
(Google Docs) files and child folders only shows the child folders.
Listing the contents of one of the child folders shows the PDFs it contains, so it seems like .gdoc
files aren't visible using this tool?
Very annoying as Google Drive has begun converting all notes from .gdoc to .docx upon zip download, with no option to turn off conversion as for uploads 😞
Edit: Notes on my solution to the latter problem are here (though still unclear why this tool can't make the process easier)
Hi there.
Default List return the file list sorted by modifiedDate
I can list with sort Order by Name?
Thanks
Hi,
Please add a new feature to delete all files(empty) in the drive instead of delete file one by one.
Thanks for useful script.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.