用途
该技能(recipe)用于列出并批量下载 Google Drive 指定文件夹中的所有文件,属于命令行流程型技能。官方描述为:List and download all files from a Google Drive folder.
前提条件
执行本 recipe 前,需要先加载 gws-drive 技能(PREREQUISITE: Load the following skills to execute this recipe: gws-drive)。
主要步骤
-
列出文件夹中的文件:
gws drive files list --params '{"q": "'\''FOLDER_ID'\'' in parents"}' --format json -
逐个下载文件:
gws drive files get --params '{"fileId": "FILE_ID", "alt": "media"}' -o filename.ext -
将 Google Docs 导出为 PDF:
gws drive files export --params '{"fileId": "FILE_ID", "mimeType": "application/pdf"}' -o document.pdf
使用方式
按上述顺序执行命令:先用 list 命令获取目标文件夹内的文件清单(以 JSON 输出),再针对清单中的每个文件执行 get 下载;若文件为 Google Docs 类型,则改用 export 命令导出为 PDF。命令中需要替换 FOLDER_ID、FILE_ID 以及输出文件名等占位符。
适用场景
适用于需要从某个 Google Drive 文件夹批量拉取全部文件到本地的任务,例如归档、迁移或离线备份。
限制
除上述步骤与前提条件外,官方资料未提供其他限制、收费、平台或效果方面的说明;相关细节暂未提供。