問題描述
請幫助我將一個項目與 Google Drive 集成.問題是 Google Drive 的垃圾文件夾永遠不會清空,因此最終由于空間不足,Google Drive 與桌面的同步停止工作.
Please help me to integrate a project with Google Drive. The problem is that Google Drive trash folder is never emptied, so eventually Google Drive synchronization with desktop stops working due to the lack of space.
我需要將垃圾箱配置為不保留已刪除的文件(首選選項),或者以編程方式從 C# 代碼(不太首選)或其他編程語言(最后的選項)中清空它.
I need either to configure the trash to not keep deleted files (preferred option) or empty it programatically from C# code (less preferred), or other programing language (last resort option) .
如何從代碼或腳本或其他內容中清空 Google 云端硬盤回收站?
How do I empty Google Drive trash from code or script or whatever?
推薦答案
Google Drive API 沒有公開清空垃圾箱的方法,但它有一個 delete
方法來永久刪除文件,無需將它們送入垃圾箱:
The Google Drive API doesn't expose a method to empty the trash but it has a delete
method to delete files permanently, without sending them into the trash:
https://developers.google.com/drive/v2/reference/文件/刪除
您還可以通過檢查 trashed 標簽從垃圾箱中檢索文件noreferrer">文件資源,然后對它們調用delete
.
You can also retrieve files from trash by checking the trashed
label of the Files resource and then call delete
on them.
這篇關于Google Drive - 如何從代碼中清空垃圾(以編程方式)?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!