Skip to content
Archive notmuch emails
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Archives notmuch indexed emails by year and month.

It'll find all emails on inbox from a starting year and archive them monthly up until last december. You end up with an inbox for the current year.

Archived email can be found under the archive tag plus year-month tags. Files are moved to ~/Maildir/.Archive.Year.Month/cur

It'll also phisically remove email tagged as deleted during those months.


See what's going to happen first:

DRYRUN=true toomuch

Then archive!



Prepend DRYRUN=true to toomuch to see what's going to happen:

DRYRUN=true toomuch

Pass starting year:

toomuch 2013

Pass up to year-month:

toomuch 2013 2013-02


onetoomany can be used with postfix to deliver email and index it:

echo "you  /path/to/onetoomany" >> /etc/postfix/mailbox_commands
postmap /etc/postfix/mailbox_commands
postconf -e "mailbox_command_maps=hash:/etc/postfix/mailbox_commands"
postfix reload

Gotcha: if you're using afew, notmuch insert will mark your email as seen, because of the missing unread tag during indexation.

To work around this, add this filter just before the InboxFilter in ~/.config/afew/config

message = Everything new is unread too
query = tag:new
tags = +unread


  • Don't hardcode email base directory
  • Be flexible about the range of dates
  • Modify search tags
  • Allow to skip archiving or removal
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.