REFILE(1mh)

πŸ“¦
version 1.8 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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 to cur
  • -draft β€” tells refile to 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, see inc(1)) πŸŽ€
  • -link β€” preserves the source folder copy of the message (i.e. it does an ln(1) instead of a mv(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 -link switch, bestie)
  • -nounlink β€” the default
  • -rmmproc program β€” override the profile's rmmproc setting 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 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 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