Created
November 29, 2015 02:35
-
-
Save michaelbrawn/4b74c879d512743e8675 to your computer and use it in GitHub Desktop.
Archive Old Unread Gmail
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 archiveInbox() { | |
// Every thread in your Inbox that is older than two days, and not starred. | |
var threads = GmailApp.search('label:inbox older_than:2d -is:starred'); | |
for (var i = 0; i < threads.length; i++) | |
threads[i].moveToArchive(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been using this for a while. https://www.johneday.com/422/time-based-gmail-filters-with-google-apps-script
Moving it to a gist.