In this article, you will learn how to automatically empty google drive trash. Let’s follow the steps:
- Make sure you use the GOOGLE CHROME web browser for the best results.
- Open Chrome and go to www.google.com
- Make sure you are signed in to your Google account. If not, sign in.
- You should OBVIOUSLY have a 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)
123456789101112function 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!
Leave a Comment