imap_archiver is a command line tool to archive messages on an imap server. You tell it what folders to archive and where to archive it. For every folder that is archived a series of folders (one for each month) is created inside the archive folder.
Jelle Helsen
gem "imap_archiver", "~> 0.0.4"