@abetomo/google-drive-cleaner 中文文档教程

发布于 3年前 浏览 26 项目主页 更新于 3年前

google-drive-cleaner

npm 版本Test

一个删除 Google Drive 文件的工具。

install

% npm install @abetomo/google-drive-cleaner

dryrun

example

  • Owner is GMAIL_ADDRESS
  • File name contains .xlsx
% google-drive-cleaner \
-a AUTH_JSON_FILE_PATH \
-q "'GMAIL_ADDRESS' in owners and name contains '.xlsx'"

因为是dryrun,所以只显示要删除的文件。

query

请参阅搜索文件和团队驱动器,了解使用 -q 指定的查询.

delete

添加 --no-dryrun 选项。

example

  • Owner is GMAIL_ADDRESS
  • File name contains .xlsx
% google-drive-cleaner \
-a AUTH_JSON_FILE_PATH \
-q "'GMAIL_ADDRESS' in owners and name contains '.xlsx'" \
--no-dryrun

通过添加 --no-dryrun 选项,驱动器上的文件将被删除。

Usage example of Node.js API

'use strict'

const GoogleDriveCleaner = require('@abetomo/google-drive-cleaner')
const googleDriveCleaner = new GoogleDriveCleaner('AUTH_JSON_FILE_PATH')
googleDriveCleaner.clean({
  query: 'Query string for searching delete files.',
  dryrun: true
})

AUTH_JSON_FILE_PATH

使用 GCP 服务帐户凭据。 您首先需要创建一个服务帐户,下载它的 json 密钥。

google-drive-cleaner

npm versionTest

A tool to remove files on Google Drive.

install

% npm install @abetomo/google-drive-cleaner

dryrun

example

  • Owner is GMAIL_ADDRESS
  • File name contains .xlsx
% google-drive-cleaner \
-a AUTH_JSON_FILE_PATH \
-q "'GMAIL_ADDRESS' in owners and name contains '.xlsx'"

Because it is dryrun, the file to be deleted is only displayed.

query

See Search for Files and Team Drives for queries specified with -q.

delete

Add --no-dryrun option.

example

  • Owner is GMAIL_ADDRESS
  • File name contains .xlsx
% google-drive-cleaner \
-a AUTH_JSON_FILE_PATH \
-q "'GMAIL_ADDRESS' in owners and name contains '.xlsx'" \
--no-dryrun

By adding the --no-dryrun option, the files on the drive are deleted.

Usage example of Node.js API

'use strict'

const GoogleDriveCleaner = require('@abetomo/google-drive-cleaner')
const googleDriveCleaner = new GoogleDriveCleaner('AUTH_JSON_FILE_PATH')
googleDriveCleaner.clean({
  query: 'Query string for searching delete files.',
  dryrun: true
})

AUTH_JSON_FILE_PATH

Use GCP service account credentials. You first need to create a service account, download its json key.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文