## IMPORTANT
This repository is not maintained anymore. [Gdrive 3](https://github.com/glotlabs/gdrive) is its successor.
```
```
## Prerequisites
None, binaries are statically linked.
If you want to compile from source you need the [go toolchain](http://golang.org/doc/install).
Version 1.5 or higher.
## Installation
### With [Homebrew](http://brew.sh) on Mac
```
brew install gdrive
```
### Other
Download `gdrive` from one of the [links in the latest release](https://github.com/prasmussen/gdrive/releases).
The first time gdrive is launched (i.e. run `gdrive about` in your
terminal not just `gdrive`), you will be prompted for a verification code.
The code is obtained by following the printed url and authenticating with the
google account for the drive you want access to. This will create a token file
inside the .gdrive folder in your home directory. Note that anyone with access
to this file will also have access to your google drive.
If you want to manage multiple drives you can use the global `--config` flag
or set the environment variable `GDRIVE_CONFIG_DIR`.
Example: `GDRIVE_CONFIG_DIR="/home/user/.gdrive-secondary" gdrive list`
You will be prompted for a new verification code if the folder does not exist.
## Compile from source
```bash
go get github.com/prasmussen/gdrive
```
The gdrive binary should now be available at `$GOPATH/bin/gdrive`
### Syncing
Gdrive supports basic syncing. It only syncs one way at the time and works
more like rsync than e.g. dropbox. Files that are synced to google drive
are tagged with an appProperty so that the files on drive can be traversed
faster. This means that you can't upload files with `gdrive upload` into
a sync directory as the files would be missing the sync tag, and would be
ignored by the sync commands.
The current implementation is slow and uses a lot of memory if you are
syncing many files. Currently only one file is uploaded at the time,
the speed can be improved in the future by uploading several files concurrently.
To learn more see usage and the examples below.
### Service Account
For server to server communication, where user interaction is not a viable option,
is it possible to use a service account, as described in this [Google document](https://developers.google.com/identity/protocols/OAuth2ServiceAccount).
If you want to use a service account, instead of being interactively prompted for
authentication, you need to use the `--service-account <serviceAccountCredentials>`
global option, where `serviceAccountCredentials` is a file in JSON format obtained
through the Google API Console, and its location is relative to the config dir.
#### .gdriveignore
Placing a .gdriveignore in the root of your sync directory can be used to
skip certain files from being synced. .gdriveignore follows the same
rules as [.gitignore](https://git-scm.com/docs/gitignore), except that gdrive only reads the .gdriveignore file in the root of the sync directory, not ones in any subdirectories.
## Usage
```
gdrive [global] list [options] List files
gdrive [global] download [options] <fileId> Download file or directory
gdrive [global] download query [options] <query> Download all files and directories matching query
gdrive [global] upload [options] <path> Upload file or directory
gdrive [global] upload - [options] <name> Upload file from stdin
gdrive [global] update [options] <fileId> <path> Update file, this creates a new revision of the file
gdrive [global] info [options] <fileId> Show file info
gdrive [global] mkdir [options] <name> Create directory
gdrive [global] share [options] <fileId> Share file or directory
gdrive [global] share list <fileId> List files permissions
gdrive [global] share revoke <fileId> <permissionId> Revoke permission
gdrive [global] delete [options] <fileId> Delete file or directory
gdrive [global] sync list [options] List all syncable directories on drive
gdrive [global] sync content [options] <fileId> List content of syncable directory
gdrive [global] sync download [options] <fileId> <path> Sync drive directory to local directory
gdrive [global] sync upload [options] <path> <fileId> Sync local directory to drive
gdrive [global] changes [options] List file changes
gdrive [global] revision list [options] <fileId> List file revisions
gdrive [global] revision download [options] <fileId> <revId> Download revision
gdrive [global] revision delete <fileId> <revId> Delete file revision
gdrive [global] import [options] <path> Upload and convert file to a google document, see 'about import' for available conversions
gdrive [global] export [options] <fileId> Export a google document
gdrive [global] about [options] Google drive metadata, quota usage
gdrive [global] about import Show supported import formats
gdrive [global] about export Show supported export formats
gdrive version Print application version
gdrive help Print help
gdrive help <command> Print command help
gdrive help <command> <subcommand> Print subcommand help
```
#### List files
```
gdrive [global] list [options]
global:
-c, --config <configDir> Application path, default: /Users/<user>/.gdrive
--refresh-token <refreshToken> Oauth refresh token used to get access token (for advanced users)
--access-token <accessToken> Oauth access token, only recommended for short-lived requests because of short lifetime (for advanced users)
--service-account <accountFile> Oauth service account filename, used for server to server communication without user interaction (file is relative to config dir)
options:
-m, --max <maxFiles> Max files to list, default: 30
-q, --query <query> Default query: "trashed = false and 'me' in owners". See https://developers.google.com/drive/search-parameters
--order <sortOrder> Sort order. See https://godoc.org/google.golang.org/api/drive/v3#FilesListCall.OrderBy
--name-width <nameWidth> Width of name column, default: 40, minimum: 9, use 0 for full width
--absolute Show absolute path to file (will only show path from first parent)
--no-header Dont print the header
--bytes Size in bytes
```
List file in subdirectory
```
./gdrive list --query " 'IdOfTheParentFolder' in parents"
```
#### Download file or directory
```
gdrive [global] download [options] <fileId>
global:
-c, --config <configDir> Application path, default: /Users/<user>/.gdrive
--refresh-token <refreshToken> Oauth refresh token used to get access token (for advanced users)
--access-token <accessToken> Oauth access token, only recommended for short-lived requests because of short lifetime (for advanced users)
--service-account <accountFile> Oauth service account filename, used for server to server communication without user interaction (file is relative to config dir)
options:
-f, --force Overwrite existing file
-r, --recursive Download directory recursively, documents will be skipped
--path <path> Download path
--delete Delete remote file when download is successful
--no-progress Hide progress
--stdout Write file content to stdout
--timeout <timeout> Set timeout in seconds, use 0 for no timeout. Timeout is reached when no data is transferred in set amount of seconds, d
没有合适的资源?快使用搜索试试~ 我知道了~
gdrive - Google Drive CLI客户端.zip
共111个文件
go:82个
license:6个
md:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 118 浏览量
2023-07-18
19:23:56
上传
评论
收藏 208KB ZIP 举报
温馨提示
gdrive - Google Drive CLI客户端
资源推荐
资源详情
资源评论
收起资源包目录
gdrive - Google Drive CLI客户端.zip (111个子文件)
AUTHORS 173B
CONTRIBUTORS 170B
.gitignore 306B
.gitignore 120B
.gitignore 7B
drive-gen.go 207KB
gdrive.go 27KB
sssp.go 25KB
undir_cg.go 17KB
undir_RO.go 16KB
dir.go 14KB
googleapi.go 13KB
sync_upload.go 13KB
sync.go 12KB
handlers_drive.go 12KB
fromlist.go 12KB
oauth2.go 11KB
adj_cg.go 11KB
adj_RO.go 11KB
dir_cg.go 11KB
dir_RO.go 10KB
random.go 9KB
adj.go 9KB
sync_download.go 9KB
undir.go 8KB
parser.go 8KB
pre_go17.go 8KB
ignore.go 7KB
token.go 7KB
doc.go 7KB
mst.go 7KB
upload.go 6KB
graph.go 6KB
media.go 6KB
context.go 6KB
download.go 6KB
resumable.go 5KB
uritemplates.go 5KB
json.go 5KB
bits.go 5KB
types.go 4KB
token.go 4KB
ctxhttp.go 4KB
util.go 3KB
transport.go 3KB
flags.go 3KB
go17.go 3KB
export.go 3KB
list.go 3KB
oauth.go 2KB
share.go 2KB
buffer.go 2KB
handler.go 2KB
changes.go 2KB
handlers_meta.go 2KB
timeout_reader.go 2KB
transport.go 2KB
oauth2.go 2KB
update.go 2KB
progress.go 2KB
sync_list.go 2KB
revision_download.go 2KB
about.go 2KB
retry.go 2KB
compare.go 2KB
info.go 2KB
file_source.go 1KB
revision_list.go 1KB
util.go 1KB
params.go 1KB
backoff.go 1KB
path.go 1KB
import.go 1KB
mkdir.go 846B
delete.go 832B
revision_delete.go 726B
errors.go 719B
bits64.go 583B
context.go 566B
client_appengine.go 530B
bits32.go 528B
cancelreq_go14.go 467B
doc.go 440B
cancelreq.go 412B
utils.go 357B
util.go 288B
drive.go 273B
drive-api.json 74KB
Godeps.json 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
README.md 37KB
README.md 2KB
hacking.md 2KB
readme.md 2KB
CONTRIBUTING.md 1KB
共 111 条
- 1
- 2
资源评论
AbelZ_01
- 粉丝: 875
- 资源: 5441
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功