$ gdrive list 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
-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)
gdrive常用命令
目录列举
1 2 3 4 5 6 7 8 9 10
gdrive [global] list [options]
options: -m, --max <maxFiles> 最大显示文件数: 30 -q, --query <query> 过滤命令,默认为: "trashed = false and 'me' in owners". 查看https://developers.google.com/drive/search-parameters --order <sortOrder> 排序. 查看See https://godoc.org/google.golang.org/api/drive/v3#FilesListCall.OrderBy --name-width <nameWidth> 文件显示字符宽度, 默认: 40, 最小: 9, 可使用 0 表示显示全部 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
文件或目录下载
1 2 3 4 5 6 7
gdrive [global] download query [options] <query>
options: -f, --force 覆盖本地同名文件 -r, --recursive 下载目录及其子目录,documents will be skipped --path <path> 下载路径 --no-progress 隐藏下载进度
options: -f, --force 覆盖本地文件 --no-progress 隐藏进度条 --stdout 输出到标准输出 --path <path> 下载路径 --timeout <timeout> Set timeout in seconds, use 0 for no timeout. Timeout is reached when no data is transferred in set amount of seconds, default: 300