REFILE(1mh)
β¨ REFILE β¨
okay bestie, welcome to refile from the nmh crew β the little command that files your messages into nmh folders π
πΈ SYNOPSIS πΈ
refile [-help] [-version] [msgs] [-draft] [-link | -nolink] [-preserve |
-nopreserve] [-retainsequences | -noretainsequences] [-unlink |
-nounlink] [-src +folder] [-file file] [-rmmproc program]
[-normmproc] +folder1 ...
π DESCRIPTION π
refile moves (peep mv(1)) or links (peep ln(1)) messages out of a source folder and into one or more destination folders. it's giving personal assistant, honestly π«Ά
think of a message like a single sheet of paper π and this whole operation like filing that sheet (or copies of it) into folders in a filing cabinet. when a message gets filed, it's linked into the destination folder(s) if that's possible, and copied otherwise. and as long as all your destination folders live on the same file system, filing the same message multiple times costs you basically no extra storage β little to no overhead, fr fr. this is the iconic way to cross-file or multiple-index your messages. like, if Jones sends you a message about the ARPA Map Project, this:
refile cur +jones +Map
means you can find that message in either the jones folder or the Map folder. chef's kiss π
you can point at the source folder with -src +folder. if you don't, it just uses the current folder, no biggie. and if you don't name any message at all, cur is the default. periodt.
-helpβ shows you the help, obviously π-versionβ spills the version info β¨msgsβ which messages to file; defaults tocur-draftβ tellsrefileto file the<mh-dir>/draftπ-src +folderβ the source folder to pull from; defaults to the current folder-file fileβ use the given file as the source message instead of a message from a folder. heads up: that file needs to be a validly formatted message, same as any other nmh message, and it should not be in mail drop format (if you wanna convert a mail-drop-format file into a folder of nmh messages, seeinc(1)) π-linkβ preserves the source folder copy of the message (i.e. it does anln(1)instead of amv(1)) π-nolinkβ the default! deletes the filed messages from the source folder ποΈ-preserveβ override the message renaming and try to keep the message's number-nopreserveβ the default; don't do that-retainsequencesβ add the message to the same sequences in the destination folder, creating any that don't exist yet-noretainsequencesβ the default; don't do that-unlinkβ actually really truly remove the files representing those messages from the source folder (β οΈ not to be confused with the-linkswitch, bestie)-nounlinkβ the default-rmmproc programβ override the profile'srmmprocsetting from the command line-normmprocβ forces the message files to be deleted by renaming or unlinking them, as described below
if a destination folder doesn't exist yet, refile will literally ask you if you wanna create it π₯Ί a "no" aborts the whole file operation. BUT β and this is the tea β if standard input for refile isn't a tty, then refile won't ask you anything at all and will just proceed as if you answered "yes" to every single question. no cap.
so, about -link: it preserves the source folder copy of the message (that's the ln(1)-instead-of-mv(1) thing), whereas -nolink β which is the default β deletes the filed messages from the source folder.
normally, when a message gets refiled, for each destination folder it gets assigned the number that's one above the current highest message number in that folder. the -preserve switch overrides that renaming and tries to preserve the message's number instead. and if there's a conflict for a particular folder while using -preserve, refile will use the next available message number above the one you wished to preserve. close enough, we tried π
message sequences are folder-specific, so moving a message out of the source folder removes it from all of its sequences in that folder. -retainsequences adds it to those same sequences in the destination folder, creating any that don't already exist. one lil exception though: this adding does not apply to the cur sequence π
βοΈ
if -link isn't specified (or if -nolink is specified), the filed messages get removed from the source folder. the default way to remove them is by renaming them with a site-dependent prefix (usually a comma). such files then need to be removed somehow after a certain amount of time β many sites set up cron to clean these files out once a day, so check with your system administrator π
alternately, if you want refile to really remove the files representing those messages from the source folder, you can use the -unlink switch (again, not to be confused with -link). but fair warning bestie:
messages removed by this method cannot be later recovered π so think before you yolo.
if you prefer a more sophisticated way of "removing" messages from the source folder, you can define the rmmproc profile component. for example, you can add a profile component like this:
rmmproc: /home/coleman/bin/rmm_msgs
and then refile will instead call that named program or script to handle the message files. main character behavior, honestly π§
you can also specify -rmmproc program on the command line to override that profile spec. and the -normmproc option forces the message files to be deleted by renaming or unlinking them, exactly as described above. back to basics β¨
and finally: the -draft switch tells refile to file the <mh-dir>/draft π¬
π FILES π
$HOME/.mh_profileβ The user profile
π PROFILE COMPONENTS π
Path:β To determine the user's nmh directoryCurrent-Folder:β To find the default current folderFolder-Protect:β To set mode when creating a new folderrmmproc:β Program to delete the message
π SEE ALSO π
folder(1), mh-sequence(5), rmf(1), rmm(1)
β DEFAULTS β
-src +folderdefaults to the current foldermsgsdefaults to cur-nolink-nounlink-nopreserve-noretainsequences
π¦ CONTEXT π¦
if -src +folder is given, it becomes the current folder. if neither -link nor all is specified, the current message in the source folder gets set to the last message specified; otherwise, the current message doesn't change at all. no notes π
if the Previous-Sequence profile entry is set, then on top of defining the named sequences from the source folder, refile will also define those sequences for the destination folders. see mh-sequence(5) for all the info about the previous sequence π
π BUGS π
since refile and rmm both use your rmmproc to delete the message, your rmmproc must not call refile or rmm without specifying -normmproc β otherwise you'll create an infinite loop π and nobody has time for that.
that's the whole page, bestie!! go forth and file responsibly πβ¨
this little love letter came to you from nmh-1.8, dated 2013-03-19 β vintage but still slaying π π
π¦ where this page comes from
- debian trixie: nmh 1.8-3
- ubuntu noble: nmh 1.8-1build4
- ubuntu questing: nmh 1.8-3
- ubuntu resolute: nmh 1.8-4
- ubuntu stonking: nmh 1.8-4build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms