A tool to remove files on Google Drive.
% npm install @abetomo/google-drive-cleaner
- 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.
See Search query terms and operators for queries specified with -q
.
Add --no-dryrun
option.
- 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.
'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
})
Use GCP service account credentials. You first need to create a service account, download its json key.