Archive Old Gmail Messages Automatically

This Google Script will scan the inbox of your Gmail and archive any message that you’ve read (seen) and is older than a month. It skips messages that are either starred or marked with a particular label like toReply.

Here’s an alternate way to deal with the same issue. It checks for individual messages in a Gmail thread before moving them to the Archive.