Google Drive 服务器应用指南

一、gdrive cli命令安装

这个是比较通用的命令,centos7以下的推荐使用。

1
2
3
4
5
#下载命令工具
wget -O /usr/sbin/gdrive https://docs.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA
chmod 755 /usr/sbin/gdrive
#验证终端
gdrive about

1.1 怎么使用gdrive

1
2
3
4
5
6
#gdrive 上传 tar 包到目录 0B2_oloQ2sUujdzFiYkNtOGhNMkU(用gdrive list查询google drive对应的目录地址),成功后删除 tar 包
/usr/sbin/gdrive upload -p 0B2_oloQ2sUujdzFiYkNtOGhNMkU --delete "/tmp/seonoco.com.tar.gz"
#上传目录
gdrive upload -p 0B1AsrnTQB-6rZ1JNWTBlMDFHdGs --recursive "/home/wwwroot/tmp"
gdrive download --recursive 0B1AsrnTQB-6rZ1JNWTBlMDFHdGs

另外,可使用gdrive help 与对应的命令 比如gdrive help upload查询详细的用法

同步上传

gdrive upload -p 1tGnCrN4XCaKI17oNW1UUwBMjextHwxpI –recursive “/home/wwwroot/sync/ebookplan”

gdrive [global] sync upload [options] Sync local directory to drive

1
2
3
4
5
6
7
8
9
10
11
12
gdrive sync upload "/home/wwwroot/sync/ebookplan" 1tGnCrN4XCaKI17oNW1UUwBMjextHwxpI
gdrive sync upload '/home/wwwroot/sync/kindlemate' 1mtcRv-OZTD8y05LUdBMlx2MNB88NzpKo
gdrive sync upload '/home/wwwroot/sync' 1PtAwU94atg4jJJKoV757yM9ncL0WBI4t
gdrive sync upload '/data/苏菇莨第一部分' 1DjotQOQuJNKTXh2SJESBYO3ThxYTvdI9 >> /data/logs/苏菇莨第一部分.log &
gdrive sync upload '/data/magzine' 1HpDYUFek1zvjPJ9tDRlrHQgWD4Hl-LcZ >> /data/logs/magzine.log &
gdrive sync upload '/data/magzine/财富' 1fi0b6jJlu3irO3CUICfmXKUI7bDAPhJM
gdrive sync upload '/home/wwwroot/ro.laikansha.com/xiake' 1atGHzcYdP81iivt36aG8mEd29ilb_I61

帮助