40cf94e997b19d38eeaf2724999d95acbb947726
[mmh] / man / refile.man
1 .\"
2 .\" %nmhwarning%
3 .\" $Id$
4 .\"
5 .TH REFILE %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
6 .SH NAME
7 refile \- file message in other folders
8 .SH SYNOPSIS
9 .HP 5
10 .B refile 
11 .RI [ msgs ]
12 .RB [ \-draft ]
13 .RB [ \-link " | " \-nolink ]
14 .RB [ \-preserve " | " \-nopreserve ]
15 .RB [ \-unlink " | " \-nounlink ]
16 .RB [ \-src
17 .IR +folder ]
18 .RB [ \-file
19 .IR file ]
20 .RB [ \-rmmproc
21 .IR program ]
22 .RB [ \-normmproc ]
23 .I +folder1
24 \&...
25 .RB [ \-version ]
26 .RB [ \-help ]
27 .SH DESCRIPTION
28 .B Refile
29 moves (see
30 .BR mv (1))
31 or links (see
32 .BR ln (1))
33 messages
34 from a source folder into one or more destination folders.
35 .PP
36 If you think of a message as a sheet of paper, this operation is not
37 unlike filing the sheet of paper (or copies) in file cabinet folders.
38 When a message is filed, it is linked into the destination folder(s)
39 if possible, and is copied otherwise.  As long as the destination
40 folders are all on the same file system, multiple filing causes little
41 storage overhead.  This facility provides a good way to cross\-file or
42 multiply\-index messages.  For example, if a message is received from
43 Jones about the ARPA Map Project, the command
44 .PP
45 .RS 5
46 refile\0cur\0+jones\0+Map
47 .RE
48 .PP
49 would allow the message to be found in either of the two folders `jones'
50 or `Map'.
51 .PP
52 You may specify the source folder using
53 .B \-src
54 .IR +folder .
55 If this is
56 not given, the current folder is used by default.  If no message is
57 specified, then `cur' is used by default.
58 .PP
59 The option
60 .B \-file
61 .I file
62 directs
63 .B refile
64 to use the specified file
65 as the source message to be filed, rather than a message from a folder.
66 Note that the file should be a validly formatted message, just like
67 any other
68 .B nmh
69 message.  It should
70 .B NOT
71 be in mail drop format
72 (to convert a file in mail drop format to a folder of
73 .B nmh
74 messages,
75 see
76 .BR inc (1)).
77 .PP
78 If a destination folder doesn't exist,
79 .B refile
80 will ask if you want
81 to create it.  A negative response will abort the file operation.  If the
82 standard input for
83 .B refile
84 is
85 .B not
86 a tty, then
87 .B refile
88 will not ask any questions and will proceed as if the user answered
89 \*(lqyes\*(rq to all questions.
90 .PP
91 The option
92 .B \-link
93 preserves the source folder copy of the message (i.e.,
94 it does a
95 .BR ln (1)
96 rather than a
97 .BR mv (1)),
98 whereas,
99 .B \-nolink
100 (the default) deletes the filed messages from the source folder.
101 .PP
102 Normally when a message is refiled, for each destination folder it
103 is assigned the number which is one above the current highest message
104 number in that folder.  Use of the
105 .B \-preserv
106 switch will override
107 this message renaming, and try to preserve the number of the message.
108 If a conflict for a particular folder occurs when using the
109 .B \-preserve
110 switch, then
111 .B refile
112 will use the next available message number
113 which is above the message number you wish to preserve.
114 .PP
115 If
116 .B \-link
117 is not specified (or
118 .B \-nolink
119 is specified), the filed
120 messages will be removed from the source folder.  The default is to
121 remove these messages by renaming them with a site-dependent prefix
122 (usually a comma).  Such files will then need to be removed in some
123 manner after a certain amount of time.  Many sites arrange for
124 .B cron
125 to remove these files once a day, so check with your
126 system administrator.
127 .PP
128 Alternately, if you wish for
129 .B refile
130 to really remove the files
131 representing these messages from the source folder, you can use the
132 .B -unlink
133 switch (not to be confused with the
134 .B \-link
135 switch).  But
136 messages removed by this method cannot be later recovered.
137 .PP
138 If you prefer a more sophisticated method of `removing' the messages
139 from the source folder, you can define the
140 .B rmmproc
141 profile
142 component.  For example, you can add a profile component such as
143 .PP
144 .RS 5
145 rmmproc:        /home/coleman/bin/rmm_msgs
146 .RE
147 .PP
148 then
149 .B refile
150 will instead call the named program or script to
151 handle the message files.
152 .PP
153 The user may specify
154 .B \-rmmproc
155 .I program
156 on the command line to
157 override this profile specification.  The
158 .B \-normmproc
159 option forces
160 the message files to be deleted by renaming or unlinking them as
161 described above.
162 .PP
163 The
164 .B \-draft
165 switch tells
166 .B refile
167 to file the <mh\-dir>/draft.
168
169 .SH FILES
170 .fc ^ ~
171 .nf
172 .ta \w'/usr/local/nmh/etc/ExtraBigFileName  'u
173 ^$HOME/\&.mh\(ruprofile~^The user profile
174 .fi
175
176 .SH "PROFILE COMPONENTS"
177 .fc ^ ~
178 .nf
179 .ta 2.4i
180 .ta \w'ExtraBigProfileName  'u
181 ^Path:~^To determine the user's nmh directory
182 ^Current\-Folder:~^To find the default current folder
183 ^Folder\-Protect:~^To set mode when creating a new folder
184 ^rmmproc:~^Program to delete the message
185 .fi
186
187 .SH "SEE ALSO"
188 folder(1), rmf(1), rmm(1)
189
190 .SH DEFAULTS
191 .nf
192 .RB ` "\-src\ +folder" "' defaults to the current folder"
193 .RB ` msgs "' defaults to cur"
194 .RB ` \-nolink '
195 .RB ` \-nounlink '
196 .RB ` \-nopreserve '
197 .fi
198
199 .SH CONTEXT
200 If
201 .B \-src
202 .I +folder
203 is given, it will become the current folder.
204 If neither
205 .B \-link
206 nor `all' is specified, the current message in the
207 source folder will be set to the last message specified; otherwise, the
208 current message won't be changed.
209 .PP
210 If the \*(lqPrevious\-Sequence\*(rq profile entry is set, in addition to defining
211 the named sequences from the source folder,
212 .B refile
213 will also define
214 those sequences for the destination folders.  See
215 .B mh\-sequence (5)
216 for information concerning the previous sequence.
217
218 .SH BUGS
219 Since
220 .B refile
221 uses your
222 .I rmmproc
223 to delete the message,
224 the
225 .I rmmproc
226 must
227 .B NOT
228 call
229 .B refile
230 without specifying
231 .BR \-normmproc ,
232 or you will create an infinite loop.