REFILE(1)

πŸ’Œ REFILE(1) β€” the refile girlies' guide πŸ’Œ

okay bestie, welcome to refile from the General Commands Manual, and no this is not the boring version, we're doing this together πŸ’–


✨ NAME ✨

refile β€” file message in 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 ✨

okay so the whole vibe of refile is: it moves messages (that's mv(1), iykyk) or links them (that's ln(1)) out of a source folder and into one or more destination folders. she's a relocator πŸ’…

Think of a message like a single sheet of paper, and this operation is literally you filing that sheet (or copies of it) into the little folders inside a file cabinet. iconic, honestly. When a message gets filed, it gets linked into the destination folder(s) if that's possible, and copied otherwise. And here's the slay: as long as all your destination folders live on the same file system, filing a message multiple times costs you basically no extra storage overhead. little-to-no storage overhead, fr fr 🫢

That makes this a genuinely great way to cross-file or multiple-index your messages. example time:

if a message shows up from Jones about the ARPA Map Project, this command

refile cur +jones +Map

means you can find that message in either of the two folders jones or Map. two homes, one message, main character energy πŸ‘‘

You can tell her where the source folder is with -src +folder. If you don't, she just uses the current folder by default. And if you don't specify any message at all? Then cur is used by default. easy πŸ’–

The -file file option directs refile to use the specified file as the source message to be filed, instead of a message from a folder. ⚠️ heads up though: that file should be a validly formatted message, just like any other nmh message. It should not be in mail drop format. (If you need to convert a file in mail drop format into a folder of nmh messages, that's what inc(1) is for, bestie.)

If a destination folder doesn't exist, refile will ask you if you want to create it. A negative response aborts the file operation, periodt. And here's the lowkey important bit: if the standard input for refile is not a tty, then refile won't ask you anything at all β€” she just proceeds as if the user answered β€œyes” to all the questions. so if you're scripting this, she is not going to wait around for your opinion πŸ™ˆ

The -link option preserves the source folder copy of the message (that means it does an ln(1) instead of a mv(1)), whereas -nolink (which is the default) deletes the filed messages from the source folder. choose your fighter πŸ’…

Normally, when a message is refiled, for each destination folder it gets assigned the number that's one above the current highest message number in that folder. Use the -preserve switch to override that message renaming and try to preserve the number of the message. But if a conflict for a particular folder happens while you're using -preserve, then refile will use the next available message number which is above the message number you wished to preserve. no cap, that's the fallback 🌸

Message sequences are folder-specific (they belong to their folder, they don't travel), so moving the 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, and creates any of those sequences that don't already exist. one exception though: this adding does not apply for the β€œcur” sequence.

If -link is not specified (or if -nolink is specified), the filed messages will be removed from the source folder. The default is to remove these messages by renaming them with a site-dependent prefix (usually a comma). Such files will then need to be removed in some manner after a certain amount of time. Many sites arrange for cron to remove these files once a day, so check with your system administrator 🧚

Alternately, if you want refile to really remove the files representing these messages from the source folder, you can use the -unlink switch β€” and do not confuse -unlink with the -link switch, they are not the same thing and the vibes are very different. 😭 But listen: messages removed by this method cannot be later recovered. gone means gone. that's a permanent deletion, bestie πŸ’€

If you prefer a more sophisticated method of removing the messages from the source folder, you can define the rmmproc profile component. For example, you can add a profile component such as

rmmproc:    /home/coleman/bin/rmm_msgs

and then refile will instead call the named program or script to handle the message files. cute, delegating πŸ’–

You may specify -rmmproc program on the command line to override this profile specification. And the -normmproc option forces the message files to be deleted by renaming or unlinking them as described above.

The -draft switch tells refile to file the <mh-dir>/draft. yes, that one. πŸŽ€


✨ FILES ✨

  • $HOME/.mh_profile β€” the user profile πŸ’–

✨ PROFILE COMPONENTS ✨

  • Path: β€” to determine the user's nmh directory
  • Current-Folder: β€” to find the default current folder
  • Folder-Protect: β€” to set mode when creating a new folder
  • rmmproc: β€” program to delete the message

✨ SEE ALSO ✨

folder(1), mh-sequence(5), rmf(1), rmm(1) πŸ¦‹


✨ DEFAULTS ✨

  • `-src +folder' defaults to the current folder
  • `msgs' defaults to cur
  • `-nolink'
  • `-nounlink'
  • `-nopreserve'
  • `-noretainsequences'

✨ CONTEXT ✨

If -src +folder is given, it will become the current folder. If neither -link nor all is specified, the current message in the source folder will be set to the last message specified; otherwise, the current message won't be changed. 🌈

If the β€œPrevious-Sequence” profile entry is set, then in addition to defining the named sequences from the source folder, refile will also define those sequences for the destination folders. See mh-sequence(5) for information concerning the previous sequence.


✨ BUGS ✨

Since refile and rmm use your rmmproc to delete the message, the rmmproc must not call refile or rmm without specifying -normmproc, or you will create an infinite loop. πŸ’€πŸ” infinite loop. do not do this. periodt.

and that's the whole page, bestie 🫢 this was nmh-1.8, dated 2013-03-19, and honestly? she ate. go file some messages πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from