GDrive — 一款Google Drive的CLI客户端 

GDrive是一款Google Drive的CLI客户端,可以上传、下载、同步文件或文件夹到Google Drive,支持Windows、Linux、OS X等多个操作系统。

下载:

FilenameVersionDescriptionShasum
gdrive-osx-x642.1.0OS X 64-bit2d817cab0912e0efa5529ada7a4bb73fe90d2d74
gdrive-osx-3862.1.0OS X 32-bited1a12998270f8176c96729d80f3f7307a2e2db6
gdrive-linux-x642.1.0Linux 64-bit6ef7c740e980358a9a5de36c1aac7ea375319aa3
gdrive-linux-3862.1.0Linux 32-bit03f423fc7a444e95de3998d24dbfbdb0335fd055
gdrive-linux-rpi2.1.0Linux Raspberry Pi0247d36e2591ea009ddbd003300bf10cb58089da
gdrive-linux-arm642.1.0Linux arm 64-bit3a41c27e10587eef0be20fe00415c65723fa3aee
gdrive-linux-arm2.1.0Linux arm 32-bit0247d36e2591ea009ddbd003300bf10cb58089da
gdrive-linux-mips642.1.0Linux mips 64-bit69bdf4b9a4ae1f9ead9d35ba118a70005bea3829
gdrive-linux-mips64le2.1.0Linux mips 64-bit le421ae3662ed9b486649560512e3c8a43dbf6cdc6
gdrive-linux-ppc642.1.0Linux PPC 64-bit9b1621d1656fa8e4f2be21202708ab3bb8c0aa77
gdrive-linux-ppc64le2.1.0Linux PPC 64-bit le0bf501abb505f851a7592456db304f2c4430e9cd
gdrive-windows-386.exe2.1.0Window 32-bit4974290122f635d9c71875bc2c760e46b943c5ab
gdrive-windows-x64.exe2.1.0Windows 64-bit53780f9a4168c71fd9f3d429932207069d1dcf03
gdrive-dragonfly-x642.1.0DragonFly BSD 64-bit5871ee54f992b71b3a1586ec224d93a79265a8b4
gdrive-freebsd-x642.1.0FreeBSD 64-bitad4d16b0144b8fd05ef7f3174a54fe39b04a766d
gdrive-freebsd-3862.1.0FreeBSD 32-bitcc636c839434689b73274e3574ac8477c9542880
gdrive-freebsd-arm2.1.0FreeBSD arm19abe4b23ad7dd968d0089313eca3108601dca02
gdrive-netbsd-x642.1.0NetBSD 64-bit07af67d4a149a926ee9ccf82591a593eb2330c36
gdrive-netbsd-3862.1.0NetBSD 32-bit95a090ff3ecb8b6e2180afb02bec6ba7419a33e0
gdrive-netbsd-arm2.1.0NetBSD armb953d575f2c306053e31718050698c47388dea26
gdrive-openbsd-x642.1.0OpenBSD 64-bitac8dbed27ffd7ed0b13b2abb8be4b5ca72da9d7c
gdrive-openbsd-3862.1.0OpenBSD 32-bitd7a2d1441d3b41e36da080643c3d5f6306181eae
gdrive-openbsd-arm2.1.0OpenBSD arm9e508032367471515199f6787aa771e271d307f4
gdrive-solaris-x642.1.0Solaris 64-bitc18612da275065064aa650b669de7140dcd94a5f
gdrive-plan9-x642.1.0Plan9 64-bit8907f5ffb8c5d6b2e15cd9d8f5a51ef762173298
gdrive-plan9-3862.1.0Plan9 32-bitf60b749ba57b8b2d824d06a7bd788a8c5808a607

安装:

# 以Linux x64版本为例:
wget -O /usr/bin/gdrive "https://docs.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA"
chmod +x /usr/bin/gdrive

授权:

# 输入`gdrive about`,将会返回一个网址,复制这个网站在浏览器中打开,你将会得到一个验证码,在下面输入你的验证码

[email protected]:/home/jianrry/test# gdrive about
Authentication needed
Go to the following url in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=offline&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: 

用法:

  • gdrive [global] list [options] 列出文件
  • gdrive [global] download [options] 下载文件或文件夹
  • gdrive [global] download query [options] 下载所有查询匹配的文件和文件夹
  • gdrive [global] upload [options] 上传文件或文件夹
  • gdrive [global] upload - [options] 上传指定的文件(文件名)
  • gdrive [global] update [options] 上传文件, this creates a new revision of the file
  • gdrive [global] info [options] 显示文件信息
  • gdrive [global] mkdir [options] 创建文件夹
  • gdrive [global] share [options] 共享文件或文件夹
  • gdrive [global] share list 列出文件的权限
  • gdrive [global] share revoke 取消文件的权限
  • gdrive [global] delete [options] 删除文件或文件夹
  • gdrive [global] sync list [options] 列出Google Drive上所有同步文件夹
  • gdrive [global] sync content [options] 列出同步文件夹的内容
  • gdrive [global] sync download [options] 同步Google Drive到本地文件夹
  • gdrive [global] sync upload [options] 同步本地文件夹到Google Drive
  • gdrive [global] changes [options] 列出文件的变化
  • gdrive [global] revision list [options] List file revisions
  • gdrive [global] revision download [options] Download revision
  • gdrive [global] revision delete Delete file revision
  • gdrive [global] import [options] 上传文件并将其转换为Google文档,有关可用转化的信息,请参阅“关于导入”
  • gdrive [global] export [options] 导出谷歌文档
  • gdrive [global] about [options] 查看Google drive的账号信息
  • gdrive [global] about import 显示支持的导入格式
  • gdrive [global] about export 显示支持的导出格式
  • gdrive version 显示Gdrive的版本信息
  • gdrive help 显示帮助信息
  • gdrive help 显示有关命令的帮助信息
  • gdrive help Print subcommand help

实例:

# 实例一:列出文件

$ gdrive list
Id                             Name                    Type   Size     Created
0B3X9GlR6EmbnZ3gyeGw4d3ozbUk   drive-windows-x64.exe   bin    6.6 MB   2015-07-18 16:43:58
0B3X9GlR6EmbnTXlSc1FqV1dvSTQ   drive-windows-386.exe   bin    5.2 MB   2015-07-18 16:43:53
0B3X9GlR6EmbnVjIzMDRqck1aekE   drive-osx-x64           bin    6.5 MB   2015-07-18 16:43:50
0B3X9GlR6EmbnbEpXdlhza25zT1U   drive-osx-386           bin    5.2 MB   2015-07-18 16:43:41
0B3X9GlR6Embnb095MGxEYmJhY2c   drive-linux-x64         bin    6.5 MB   2015-07-18 16:43:38


# 实例二:上传文件(上传到根目录)

$ gdrive upload gdrive-osx-x64
Uploading gdrive-osx-x64
Uploaded 0B3X9GlR6EmbnZ1NGS25FdEVlWEk at 3.8 MB/s, total 8.3 MB


# 实例三:创建文件夹

$ gdrive mkdir gdrive-bin
Directory 0B3X9GlR6EmbnY1RLVTk5VUtOVkk created


# 实例四:上传文件(上传到指定文件夹)

$ gdrive upload --parent 0B3X9GlR6EmbnY1RLVTk5VUtOVkk gdrive-osx-x64
Uploading gdrive-osx-x64
Uploaded 0B3X9GlR6EmbnNTk0SkV0bm5Hd0E at 2.5 MB/s, total 8.3 MB


# 实例五:下载文件

$ gdrive download 0B3X9GlR6EmbnZ1NGS25FdEVlWEk
Downloading gdrive-osx-x64 -> gdrive-osx-x64
Downloaded 0B3X9GlR6EmbnZ1NGS25FdEVlWEk at 8.3 MB/s, total 8.3 MB


# 实例六:共享文件

$ gdrive share 0B3X9GlR6EmbnNTk0SkV0bm5Hd0E
Granted reader permission to anyone


# 实例七:同步文件

# Sync to drive
$ gdrive sync upload _release/bin 0B3X9GlR6EmbnOEd6cEh6bU9XZWM
Starting sync...
Collecting local and remote file information...
Found 32 local files and 0 remote files

6 remote directories are missing
[0001/0006] Creating directory drive-bin/bsd
[0002/0006] Creating directory drive-bin/linux
[0003/0006] Creating directory drive-bin/osx
[0004/0006] Creating directory drive-bin/plan9
[0005/0006] Creating directory drive-bin/solaris
[0006/0006] Creating directory drive-bin/windows

26 remote files are missing
[0001/0026] Uploading bsd/gdrive-dragonfly-x64 -> drive-bin/bsd/gdrive-dragonfly-x64
[0002/0026] Uploading bsd/gdrive-freebsd-386 -> drive-bin/bsd/gdrive-freebsd-386
[0003/0026] Uploading bsd/gdrive-freebsd-arm -> drive-bin/bsd/gdrive-freebsd-arm
[0004/0026] Uploading bsd/gdrive-freebsd-x64 -> drive-bin/bsd/gdrive-freebsd-x64
[0005/0026] Uploading bsd/gdrive-netbsd-386 -> drive-bin/bsd/gdrive-netbsd-386
[0006/0026] Uploading bsd/gdrive-netbsd-arm -> drive-bin/bsd/gdrive-netbsd-arm
[0007/0026] Uploading bsd/gdrive-netbsd-x64 -> drive-bin/bsd/gdrive-netbsd-x64
[0008/0026] Uploading bsd/gdrive-openbsd-386 -> drive-bin/bsd/gdrive-openbsd-386
[0009/0026] Uploading bsd/gdrive-openbsd-arm -> drive-bin/bsd/gdrive-openbsd-arm
[0010/0026] Uploading bsd/gdrive-openbsd-x64 -> drive-bin/bsd/gdrive-openbsd-x64
[0011/0026] Uploading linux/gdrive-linux-386 -> drive-bin/linux/gdrive-linux-386
[0012/0026] Uploading linux/gdrive-linux-arm -> drive-bin/linux/gdrive-linux-arm
[0013/0026] Uploading linux/gdrive-linux-arm64 -> drive-bin/linux/gdrive-linux-arm64
[0014/0026] Uploading linux/gdrive-linux-mips64 -> drive-bin/linux/gdrive-linux-mips64
[0015/0026] Uploading linux/gdrive-linux-mips64le -> drive-bin/linux/gdrive-linux-mips64le
[0016/0026] Uploading linux/gdrive-linux-ppc64 -> drive-bin/linux/gdrive-linux-ppc64
[0017/0026] Uploading linux/gdrive-linux-ppc64le -> drive-bin/linux/gdrive-linux-ppc64le
[0018/0026] Uploading linux/gdrive-linux-x64 -> drive-bin/linux/gdrive-linux-x64
[0019/0026] Uploading osx/gdrive-osx-386 -> drive-bin/osx/gdrive-osx-386
[0020/0026] Uploading osx/gdrive-osx-arm -> drive-bin/osx/gdrive-osx-arm
[0021/0026] Uploading osx/gdrive-osx-x64 -> drive-bin/osx/gdrive-osx-x64
[0022/0026] Uploading plan9/gdrive-plan9-386 -> drive-bin/plan9/gdrive-plan9-386
[0023/0026] Uploading plan9/gdrive-plan9-x64 -> drive-bin/plan9/gdrive-plan9-x64
[0024/0026] Uploading solaris/gdrive-solaris-x64 -> drive-bin/solaris/gdrive-solaris-x64
[0025/0026] Uploading windows/gdrive-windows-386.exe -> drive-bin/windows/gdrive-windows-386.exe
[0026/0026] Uploading windows/gdrive-windows-x64.exe -> drive-bin/windows/gdrive-windows-x64.exe
Sync finished in 1m18.891946279s

参考资料:

GitHub项目主页

Gdrive:Linux下谷歌网盘同步工具、自动备份VPS文件到Google Drive

最后修改:2019 年 07 月 22 日 09 : 52 PM
如果觉得我的文章对你有用,请随意赞赏

发表评论