自动从 Google Drive 垃圾箱中删除文件 [英] Automatically delete file from Google Drive trash
问题描述
有几篇文章,但我无法将代码放在一起成功运行.
There are several articles, but I am not able to put a code together to run it successfully.
我看过的一篇文章:从谷歌驱动器中永久删除文件
我想每隔一小时左右自动删除 Google 云端硬盘垃圾文件夹中的项目.最好每 10 分钟一次.谷歌需要实现这个有用的功能.
I would like to automatically delete the Google Drive trash folder items every hour or so. Prefer every 10 minutes. Google need to implement this useful feature.
推荐答案
如 [Permanently delete file from google drive ],您可以通过 Appscript 启用 Drive API 以访问该方法.查看 appscript 配额 以确保您的实现可以支持调用API 每十分钟一次.
As stated on [ Permanently delete file from google drive ], you can enable the Drive API in order to get access to the method, through Appscript. Take a look at appscript quotas to ensure that your implementation can support calling the API every ten minutes.
你可以使用这个解决方案:
You can use this solution:
function createTimeDrivenTriggers() {
ScriptApp.newTrigger('emptyThrash')
.timeBased()
.everyHours(1)
.create();
}
function emptyThrash()
{
Drive.Files.emptyTrash();
}
这篇关于自动从 Google Drive 垃圾箱中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!