Auto delete google drive trash
When google drive syncs your files and folders. and you delete them on your computer. they stil take up space in google drive account. and the files stay there for 30 days
this guide can help you set up auto delete of trash files
https://gist.github.com/relativeflux/032d4087245cf8aa5b21eccfbf836435
## Automatically Empty Google Drive Trash
Adapted from https://www.amixa.com/blog/2019/04/05/automatically-empty-google-drive-trash/
1. Make sure you use Google's [Chrome](https://www.google.com/intl/en/chrome/) web browser for best results.
2. Open Chrome and go to www.google.com.
3. Make sure you are signed into your Google account. If not, sign in.
4. You should obviously have Google Drive account up and running.
5. Visit https://script.google.com/home and click **NEW PROJECT**
6. Clear out the default code that appears in the next window, and paste in the following:
```
function createTimeDrivenTriggers() {
ScriptApp.newTrigger('emptyThrash')
.timeBased()
.everyHours(1)
.create();
}
function emptyThrash() {
Drive.Files.emptyTrash();
}
```
7. Click the **Save** Icon.
8. Enter a name such as *“Automatically Empty Google Drive Trash”*.
9. Click the **Resources -> Advanced Google Services”** menu within the Code editor.
10. Scroll down and turn **Drive API** to **ON**.
11. You should see a message *“These services must also be enabled in the Google Cloud Platform API Dashboard”*. Click that link.
12. **N.B.**: If you DO NOT see the message above, click [this direct link](https://console.cloud.google.com/apis/dashboard).
13. Click **ENABLE APIS AND SERVICES**.
14. Locate **Google Drive API** and click it.
15. Click **Enable**.
16. Return to the browser window with **Advanced Google Services** still open and click **OK**.
17. Click the **Run** icon within the project editor.
18. You should see *“Authorization Required”*. Click **Review Permissions**.
19. Choose your Google account (this step links the script to the proper account).
20. You will see *“This app isn’t verified”*. Click **Advanced**, then click **Go to XXXX Project (unsafe)**.
21. Click **ALLOW**.
22. Save your project again.
23. Go to **Run->Run Function->createTimeDrivenTriggers**.
24. Hit the **Timer** icon.
25. You should see your project listed under **Triggers**.
Your job is now scheduled to run every hour and empty your trash.