Created
January 17, 2017 07:17
-
-
Save psankar/b69a2d70bca519cd8461d96e3d7185dc to your computer and use it in GitHub Desktop.
GMailAutoDelete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function batchDeleteA() { | |
var batchSize = 100 // Process up to 100 threads at once | |
for (i = 0; i < 50; i++) { | |
var threads = GmailApp.search('label:"<LABEL_TO_DELETE>" older_than:2m'); | |
for (j = 0; j < threads.length; j+=batchSize) { | |
GmailApp.moveThreadsToTrash(threads.slice(j, j+batchSize)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment