Skip to content

Instantly share code, notes, and snippets.

@joa
Created June 6, 2013 12:17
Show Gist options
  • Save joa/5721080 to your computer and use it in GitHub Desktop.
Save joa/5721080 to your computer and use it in GitHub Desktop.
Gmail Life Saver
function archiveInbox() {
var query = 'label:inbox is:read older_than:28d -label:unanswered -label:unread';
var batchSize = 100;
while(GmailApp.search(query, 0, 1).length == 1) {
GmailApp.moveThreadsToArchive(GmailApp.search(query, 0, batchSize));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment