Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a new folder from within Mutt. I use Maildir format to store the folders on the machine I am running Mutt on.

(I also view the mail remotely using courier IMAP but this doesnt involve Mutt)

Edited to clarify role of IMAP

share|improve this question
    
I'm using Dovecot, and it supports activating the imapd directly from shell; for example, dovecot --exec-mail imap, which can be used for Mutt's set tunnel=. Maybe Courier has a similar thing too? It would allow mailbox creation within Mutt. (/usr/lib/courier/imap might be enough.) – grawity Jun 21 '10 at 16:20
up vote 3 down vote accepted

If Mutt cannot create maildirs directly, it is easy to do it yourself. A "Maildir" format mail directory has nothing special except for three subdirectories cur/, new/ and tmp/ inside.

Assuming that your mail is kept under ~/mail/, a folder named "Something" would be created like:

  • For the Maildir++ layout used by Courier and Dovecot:

    mkdir -p ~/mail/.Something/{cur,new,tmp}
    

    (Note the leading dot – yes, this basically means subfolders are stored as hidden directories...)

    Equivalent to:

    mkdir ~/mail                    (implied by `-p`)
    mkdir ~/mail/.Something         (implied by `-p`)
    mkdir ~/mail/.Something/cur     (from brace expansion)
    mkdir ~/mail/.Something/new     (from brace expansion)
    mkdir ~/mail/.Something/tmp     (from brace expansion)
    
  • For the "filesystem" layout used by some other IMAP daemons:

    mkdir -p ~/mail/Something/{cur,new,tmp}
    

If you want a folder hierarchy "Archive" / "2010" / "06":

  • In Courier's layout, the folder would be named Archive.2010.06:

    mkdir -p ~/mail/.Archive.2010.06/{cur,new,tmp}
    
  • In the "filesystem" layout, it would be Archive/2010/06:

    mkdir -p ~/mail/Archive/2010/06/{cur,new,tmp}
    

(Terminology: mail clients keep messages in 'folders', and the filesystem stores everything in 'directories'.)

share|improve this answer

c (change-folder), ? (list), Shift+C (create-mailbox)

share|improve this answer
    
This only works across IMAP (i have reworded my question). I wonder if I ought to be using maildirmake -f – justintime Jun 21 '10 at 8:26
    
@justin: Posted other answer. – grawity Jun 21 '10 at 9:57

I usually just save some email to new not-yet-existing folder, and mutt creates the folder for me.

For me it's pretty intuitive, as there is no point in having folder without mails in it, so I just create it by saving there first mails that should go there.

share|improve this answer
    
How do you do that - if you type M it then gives me a list of existing mailboxes. Thanks – justintime Jun 24 '10 at 10:09
    
"M"? I don't know what "M" does. I just press "s" on index of maildir, and then I can type my requested folder name. – user7385 Jun 24 '10 at 11:48
    
@justintime s – isomorphismes Mar 27 '14 at 8:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .