refile Command

Purpose

Moves files between folders.

Syntax

refile [ -src +Folder ] [ -draft ] [ -file File ] [ Messages ] [ -nolink | -link ] [ -nopreserve | -preserve ] +Folder ...

Description

The refile command moves messages between folders. If you do not specify a source folder, the refile command uses the current folder as the source. If you specify a destination folder that does not exist, the system requests permission to create it.

The refile command also copies messages from one folder to another. When moving a message, by default, the system does not keep a copy of the message in the original folder. To leave a copy behind, use the -preserve flag.

Flags

Item Description
-draft Copies the current draft message from your mail directory.
-file File Copies the specified file. The file must be in valid message format. Use the inc command to format and file new messages correctly.
+Folder Copies the messages to the specified folder. Any number of folders can be specified.
-help Lists the command syntax, available switches (toggles), and version information.
Note: For MH, the name of this flag must be fully spelled out.
-link Leaves the messages in the source folder or file after they are copied.
Messages Specifies the messages to be copied. You can specify several messages, a range of messages, or a single message. Use the following references to specify messages:
Number
Number of the message.
Sequence
A group of messages specified by the user. Recognized values include:
all
All the messages in a folder.
cur or . (period)
Current message. This is the default.
first
First message in a folder.
last
Last message in a folder.
next
Message following the current message.
prev
Message preceding the current message.
 
 /DT>
If the -link and all flags are used together, the current message in the current folder does not change. Otherwise, if a message is specified, the refiled message becomes the current message.
-nolink Removes the messages from the source folder or file after they are copied. This flag is the default.
-nopreserve Renumbers the messages that are copied. Renumbering begins with a number one higher than the last message in the destination folder. This flag is the default.
-preserve Preserves the message numbers of copied messages. If messages with these numbers already exist, the refile command issues an error message and does not alter the contents of the folders.
-src +Folder Identifies the source folder. By default, the system uses the current folder.

Profile Entries

The following entries are part of the UserMHDirectory/.mh_profile file:

Item Description
Current-Folder: Sets the default current folder.
Folder-Protect: Sets the protection level for your new folder directories.
Path: Specifies the UserMhDirectory.
rmmproc: Specifies the program used to remove messages from a folder.

Security

Attention RBAC users and Trusted AIX® users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

  1. To refile the current message from the current folder and place it in a new folder called meetings, enter:

    refile  +meetings

    The system responds with a message similar to the following:
    Create folder "/home/jeanne/Mail/meetings"?
    Enter y to create the folder. A copy of the original message is not retained in the current folder.
  2. To copy the current message from the current folder and to the meetings folder, enter:

    refile  -link +meetings

    The original message remains in the current folder.
  3. To refile the current message draft into the test folder, enter:

    refile  -draft +test

    A copy of the message draft is not retained in the current folder.
  4. To refile the current message from the current folder and into several folders, enter:

    refile  +tom +pat +jay

    A copy of the message is not retained in the current folder.

Files

Item Description
$HOME/.mh_profile Sets the MH user profile.
/usr/bin/refile Contains the refile command.