{
    "mode": "man",
    "parameter": "mh-folders",
    "section": "5mh",
    "url": "https://www.chedong.com/phpMan.php/man/mh-folders/5mh/json",
    "generated": "2026-10-10T10:09:02Z",
    "sections": {
        "NAME": {
            "content": "mh-folders - storage format used by nmh message system\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "nmh stores messages in the files and directories of the host filesystem according to the fol‐\nlowing rules:\n",
            "subsections": [
                {
                    "name": "one folder per directory",
                    "content": "An  nmh  folder  corresponds to a directory.  There are no limits on folder names beyond\nthose of the host filesystem.\n"
                },
                {
                    "name": "one message per file",
                    "content": "The file name is a positive integer.  Other files containing metadata or arbitrary names\ncan exist in a folder; while the preference is that non-message files  begin  with  “.”,\nall files that are not positive integers must be ignored by an MH-compatible implementa‐\ntion.   However,  implementations are free to indicate to the user the existence of non-\nmessage files that are not prefixed with a “.”.\n\nThe filename for a new message is one greater than the highest numbered message  in  the\nfolder;  its  full  path  can be accessed by the pseudo-sequence new (e.g., mhpath new).\nNew messages are only permitted to be added to a folder at the end of the message number\nrange.\n\nTo add a new message to a folder, the recommended sequence is:\n\n•   Create a temporary file in the desired folder.\n\n•   Attempt to link the temporary file to the new message number.\n\n•   If successful, remove the temporary file.  If the link fails, increment the  message\nnumber and try again."
                },
                {
                    "name": "context",
                    "content": "There  is  one context file.  Its default location is in the user's Path and its default\nname is context, but these can be overridden by  the  $MHCONTEXT  environment  variable.\ncontext has the following format:\n\nCurrent-Folder: +folder\natr-sequence-path: m[-n] [...]\n\nwhere  folder  is  the directory name of the current folder.  Lines beginning with “atr”\nare used for private sequences.  sequence is the name of the private sequence,  path  is\nthe  full path to the folder with the private sequence, and m[-n] is a message number or\nrange of message numbers in the sequence.\n"
                },
                {
                    "name": "sequences",
                    "content": "There is one sequences file in each nmh folder.  Its default name is .mhsequences,  but\nthis can be overridden by the “mh-sequences” profile entry.  sequences has the following\nformat:\n\nsequence: m[-n] [...]\n\nshowing  the  (possibly  empty) message numbers and/or ranges of message numbers in each\nsequence.  The cur sequence has at most just a single message number, not a range.\n\nSequence names have a maximum size of 998 characters.  Each line is also  limited  to  a\nmaximum  of  998 characters, but RFC 822 continuation rules apply; sequences can be con‐\ntinued across multiple lines by prefixing continuation lines with a  whitespace  charac‐\nter.\n\nIf  an  implementation finds messages in a sequence that do not exist, the sequence file\nshould be updated to remove the missing messages from the sequence.  If a sequence  con‐\ntains  no  messages, it should be removed from the sequence file.  The exception to this\nis the cur sequence, which can refer to a nonexistent message.\n"
                },
                {
                    "name": "Locking",
                    "content": "nmh programs read and write the context and sequences files, and lock these  files  when  ac‐\ncessing  them.   There should not be a need to access these files directly; instead, programs\nsuch as flist, folder, mark, pick, and rcvstore should be used to query and update their con‐\ntents.  Any program outside of nmh that accesses these files must be sure to lock them  using\nthe same locking method as nmh.  The default data locking method is selected when nmh is con‐\nfigured and can be accessed as a string using mhparam datalocking.  By default, fcntl locking\nis used, but this may be overridden by the datalocking profile entry.\n\nA second, possibly different, locking method is used by inc(1) when accessing the user's mail\nspool file or by nmh programs that open any mbox file.  This locking method can be overridden\nwhen nmh is configured, or in the nmh mts configuration file, and can be accessed as a string\nusing  mhparam spoollocking.  By default, kernel-level locking is used if appropriate for the\nplatform, and it is for popular platforms.  That default should also be the same as  used  by\nthe mail program, if provided on the platform.\n"
                },
                {
                    "name": "Naming",
                    "content": "nmh  folders  can  be  given arbitrary names, with one exception: folders should not be given\nall-numeric names.  This limitation results from nmh messages themselves being stored in  nu‐\nmerically  named  files  -- allowing folders to be named similarly would make nmh slower, and\nintroduce usage ambiguities.\n"
                }
            ]
        },
        "FILES": {
            "content": "<mh-dir>/context    The user's context.\n$MHCONTEXT          Overrides the above context.\n<folder>/.mh-sequences\nPublic sequences for <folder>.",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "flist(1), folder(1), mail(1), mark(1), mhparam(1), mhpath(1), mh-profile(5),  mh-sequence(5),\nmh-tailor(5), pick(1), rcvstore(1)\n\nnmh-1.8                                      2016-02-25                              MH-FOLDERS(5mh)",
            "subsections": []
        }
    },
    "summary": "mh-folders - storage format used by nmh message system",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "flist",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/flist/1/json"
        },
        {
            "name": "folder",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/folder/1/json"
        },
        {
            "name": "mail",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/mail/1/json"
        },
        {
            "name": "mark",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/mark/1/json"
        },
        {
            "name": "mhparam",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/mhparam/1/json"
        },
        {
            "name": "mhpath",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/mhpath/1/json"
        },
        {
            "name": "mh-profile",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/mh-profile/5/json"
        },
        {
            "name": "mh-sequence",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/mh-sequence/5/json"
        },
        {
            "name": "mh-tailor",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/mh-tailor/5/json"
        },
        {
            "name": "pick",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pick/1/json"
        },
        {
            "name": "rcvstore",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/rcvstore/1/json"
        },
        {
            "name": "MH-FOLDERS",
            "section": "5mh",
            "url": "https://www.chedong.com/phpMan.php/man/MH-FOLDERS/5mh/json"
        }
    ]
}