Automatically Empty Google Drive Trash
Want to empty your Google Drive Trash automatically? I finally have the solution for you.
- Make sure you use GOOGLE CHROME web browser for best results.
- Open Chrome and go to www.google.com
- Make sure you are signed into your Google account. If not, sign in.
- You should OBVIOUSLY have Google Drive account up and running since that’s why you’re here, right?
- Go here https://script.google.com/home
- Click NEW PROJECT.
- Clear out the default code that appears in the next window.
- Paste in this code (exactly)
function createTimeDrivenTriggers() { ScriptApp.newTrigger('emptyThrash') .timeBased() .everyHours(1) .create(); } function emptyThrash() { Drive.Files.emptyTrash(); }
- Click the Save Icon
- Enter a name such as “Automatically Empty Google Drive Trash”
- Click the “Resources -> Advanced Google Services” menu within the Code editor
- Scroll down and turn “Drive API” to “ON”
- You should see a message “These services must also be enabled in the Google Cloud Platform API Dashboard”. Click that link.
- NOTE: If you DO NOT see the message above, click this direct link
- Click “ENABLE APIS AND SERVICES”
- Locate “Google Drive API” and click it.
- Click Enable
- Go back to your browser window with the “Advanced Google Services” window still open.
- Click OK
- Click the “Run” icon within the project editor
- You should see “Authorization Required”. Click Review Permissions
- Choose your google account (this links up the script with the proper account).
- You will see “This app isn’t verified”. Click Advanced. Click Go to XXXX Project (unsafe).
- Click ALLOW
- Save your project again.
- Go to “Run->Run Function->createTimeDrivenTriggers”
- Hit the “Timer” icon.
- You should see your project listed under “Triggers”
- Your job is now scheduled to run every 1 hour and empty your trash!
This process was crafted by deciphering the following two pages:
https://stackoverflow.com/questions/32749289/automatically-delete-file-from-google-drive-trash
https://stackoverflow.com/questions/25749906/permanently-delete-file-from-google-drive/32749203
Thanks. I have been looking for this function for a year now.
This was just what I needed to fully automate my sync process from NAS to gDrive.
I can’t believe Google has no similar option to schedule this purge, or even to disable the trash bin directly.
Many thanks!
Don’t work for me ((
at # 19 I see:
Sign in with Google temporarily disabled for this app
This app has not been verified yet by Google in order to use Google Sign In.
and no “Advanced” button…
Very Useful i really enjoyed your sharing
Thanks for Sharing