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.
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) .
How do I empty Google Drive trash from code or script or whatever?
Here is a complete solution:
1) Create an empty script on your drive
2) Paste the following code:
3) Deploy the script as a web application
4) Click on the clock on the top bar and create a trigger that invokes the doGet method
This will empty the trash for the user that is creating the trigger.
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/files/delete
You can also retrieve files from trash by checking the
trashed
label of the Files resource and then calldelete
on them.Here a shorter version, i tried using the above solution, but with no luck.
All you have to do is to enable de drive api, in the Resources Menu-> Google Advanced Services and in google developers's console...