Hide a message?

Cameron Simpson cs at cskk.id.au
Thu Dec 13 22:27:46 UTC 2018


On 13Dec2018 23:15, Victor Sudakov <vas at sibptus.ru> wrote:
>I have over 400 mboxes in my ~/Mail directory, some of them being
>mailing list archives, others being Usenet groups archives, or mboxes 
>inherited from my decommissioned CommuniGate server.
>
>My dovecot configuration is simple: "mail_location = mbox:~/Mail:INBOX=/var/mail/%u"
>
>If I knew how to convert all this stuff to Maildir storage... Do I have 
>to convert all of them at once?

You don't need to do them all at once, or all at all!

I keep my archive folders as mbox and several of my bulky and rarely 
visited folders as mbox, with the active folders (eg my "python" and 
"mutt" folders) as Maildir.

Others have spoken of preserving attributes (read, flagged, etc). You 
get all of this by using mutt itself to perform the conversion. Basic 
scheme:

- make an empty maildir
- open the mbox with mutt
- save all messages to the maildir
- close mutt

Now you have an empty mbox and a new Maildir with the same messages.  
Sounds tedious? You can script this. See this script:

  https://bitbucket.org/cameron_simpson/css/src/tip/bin/mboxify

which converts Maildir to mbox (I was going the other way). It would be 
trivial to adapt it to convert mbox to Maildir. If you're rolling your 
own script you will be particularly interested in the mutt incantation 
in the middle:

  mutt -n -F /dev/null -f "$mailbox" -e "set sort=mailbox-order; set confirmappend=no; set delete=yes; push '<tag-pattern>.<enter><tag-prefix><save-message>$mailboxtmp<enter><sync-mailbox><exit>'"

That is all on one line, in case the email folds it up. In the 
incantation $mailbox is the source Maildir folder and $mailboxtmp is the 
target mbox file. The latter is a scratch file, renamed to the original 
if everything going smoothly; you will see the script itself does a fair 
bit of sanity checking toavoid accidents.

You would reverse that, in that $mailbox would be a source mbox file and 
$mailboxtmp with be a shiny new Maildir folder.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Mutt-users mailing list