| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
 | gdrive
======
## Overview
gdrive is a command line utility for uploading and downloading single files to your Google Drive.
This tool on its own does not do synchronization of any kind, if you want that you can use googles own tool.
It is meant for one-off uploads or downloads and integration with other unix tools. One use-case could be
daily uploads of a backup archive for off-site storage.
## Prerequisites
None, binaries are statically linked.
If you want to compile from source you need the go toolchain: http://golang.org/doc/install
## Installation
- Save the 'drive' binary to a location in your PATH (i.e. `/usr/local/bin/`)
- Or compile it yourself `go build drive.go`
### Downloads
- [drive-osx-386 v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbncGxTRVMtVFowMWM)
- [drive-osx-amd64 v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbnM0FSUFY4TDYxMFk)
- [drive-freebsd-386 v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbncjhleU84ZmdPWUU)
- [drive-freebsd-amd64 v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbncEcySTZEdUVIYUU)
- [drive-linux-386 v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbnblQ3N0hhMnZCcTA)
- [drive-linux-amd64 v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbnVW5VZ0dvdmlsd1k)
- [drive-linux-arm v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbnaUt1VkJwQkFWT1k)
- [drive-linux-rpi v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbnZFhTNXBGaVl5TG8)
- [drive-windows-386.exe v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbndTNpNUlxUVdralU)
- [drive-windows-amd64.exe v1.4.0](https://drive.google.com/uc?id=0B3X9GlR6EmbncVVxendwazcwM00)
## Usage
    drive [global options] <verb> [verb options]
#### Options
    Global options:
            -a, --advanced Advanced Mode -- lets you specify your own oauth client id and secret on setup
            -c, --config   Set application path where config and token is stored. Defaults to ~/.gdrive
            -v, --version  Print version
            -h, --help     Show this help
    Verbs:
        delete:
            -i, --id       File Id (*)
        download:
            -i, --id       File Id (*)
            -s, --stdout   Write file content to stdout
                --pop      Download latest file, and remove it from google drive
        folder:
            -t, --title    Folder to create (*)
            -p, --parent   Parent Id of the folder
                --share    Share created folder
        info:
            -i, --id       File Id (*)
        list:
            -m, --max      Max results
            -t, --title    Title filter
            -q, --query    Query (see https://developers.google.com/drive/search-parameters)
            -s, --shared   Show shared status (Note: this will generate 1 http req per file)
            -n, --noheader Do not show the header
        share:
            -i, --id       File Id (*)
        unshare:
            -i, --id       File Id (*)
        upload:
            -f, --file     File or directory to upload (*)
            -s, --stdin    Use stdin as file content (*)
            -t, --title    Title to give uploaded file. Defaults to filename
            -p, --parent   Parent Id of the file
                --share    Share uploaded file
        url:
            -i, --id       File Id (*)
            -p, --preview  Generate preview url (default)
            -d, --download Generate download url
## Examples
###### List files
    $ drive list
    Id                             Title                     Size     Created
    0B3X9GlR6EmbnenBYSFI4MzN0d2M   drive-freebsd-amd64       5 MB     2013-01-01 21:57:01
    0B3X9GlR6EmbnOVRQN0t6RkxVQk0   drive-windows-amd64.exe   5 MB     2013-01-01 21:56:41
    0B3X9GlR6Embnc1BtVVU1ZHp2UjQ   drive-linux-arm           4 MB     2013-01-01 21:57:23
    0B3X9GlR6EmbnU0ZnbGV4dlk1T00   drive-linux-amd64         5 MB     2013-01-01 21:55:06
    0B3X9GlR6EmbncTk1TXlMdjd1ODQ   drive-darwin-amd64        5 MB     2013-01-01 21:53:34
###### Upload file or directory
    $ drive upload --file drive-linux-amd64
    Id: 0B3X9GlR6EmbnU0ZnbGV4dlk1T00
    Title: drive-linux-amd64
    Size: 5 MB
    Created: 2013-01-01 21:55:06
    Modified: 2013-01-01 21:55:06
    Owner: Petter Rasmussen
    Md5sum: 334ad48f6e64646071f302275ce19a94
    Shared: False
    Uploaded 'drive-linux-amd64' at 510 KB/s, total 5 MB
###### Download file
    $ drive download --id 0B3X9GlR6EmbnenBYSFI4MzN0d2M
    Downloaded 'drive-freebsd-amd64' at 2 MB/s, total 5 MB
###### Share a file
    $ drive share --id 0B3X9GlR6EmbnOVRQN0t6RkxVQk0
    File 'drive-windows-amd64.exe' is now readable by everyone @ https://drive.google.com/uc?id=0B3X9GlR6EmbnOVRQN0t6RkxVQk0
###### Pipe content directly to your drive
    $ echo "Hello World" | drive upload --stdin --title hello.txt
    Id: 0B3X9GlR6EmbnVHlHZWZCZVJ4eGs
    Title: hello.txt
    Size: 12 B
    Created: 2013-01-01 22:05:44
    Modified: 2013-01-01 22:05:43
    Owner: Petter Rasmussen
    Md5sum: e59ff97941044f85df5297e1c302d260
    Shared: False
    Uploaded 'hello.txt' at 6 B/s, total 12 B
###### Print file to stdout
    $ drive download --stdout --id 0B3X9GlR6EmbnVHlHZWZCZVJ4eGs
    Hello World
###### Get file info
    $ drive info --id 0B3X9GlR6EmbnVHlHZWZCZVJ4eGs
    Id: 0B3X9GlR6EmbnVHlHZWZCZVJ4eGs
    Title: hello.txt
    Size: 12 B
    Created: 2013-01-01 22:05:44
    Modified: 2013-01-01 22:05:43
    Owner: Petter Rasmussen
    Md5sum: e59ff97941044f85df5297e1c302d260
    Shared: False
###### Get a url to the file
    $ drive url --id 0B3X9GlR6EmbnVHlHZWZCZVJ4eGs
    https://drive.google.com/uc?id=0B3X9GlR6EmbnVHlHZWZCZVJ4eGs
 |