Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

mv(1) OSS Shell and Utilities Reference Manual
NAME
mv - Moves les and directories
SYNOPSIS
mv [-i | f] le1 le2
mv [-i | f] le1 ... directory
mv [ -W NOG ][-W NOE ][-i | f] directory1 ... destination_directory
The mv command moves les from one directory to another or renames les and directories.
FLAGS
-f Overrides the -i ag and any mode restrictions. If both
-f and -i are specied (for
example, because an alias includes one of them) whichever appears last overrides the
other.
-i Prompts you with the name of the le followed by a question mark whenever a move is
to supercede an existing le. If the answer begins with y, or the locales equivalent of a
y, the move continues. Any other reply prevents the move from occurring. If both -f
and -i are specied (for example, because an alias includes one of them) whichever
appears last overrides the other.
HP Extensions
-W NOG Species that the /G directory should be omitted when the initial directory is
root. This ag is ignored when the initial directory is not /, /E,or/E/system.
-W NOE Species that the /E directory should be omitted when the initial directory is
root. This ag is ignored when the initial directory is not root.
Specify both the -W NOG and -W NOE ags to omit both the /G and /E directories.
DESCRIPTION
If you move a le to a new directory, mv retains the original lename. When you move a le, all
other links to the le remain intact.
In the second form, one or more les are moved to directory with their original lenames. In the
third form, one or more directories are moved to the destination directory with their original
names.
Note that mv does not move a le onto itself.
When you use mv to rename a le, the target le can be either a new lename or a new directory
pathname. If moving the le would overwrite an existing le, the existing le is overwritten
unless you specify the -i ag, in which case you will be prompted. If moving the le would
overwrite an existing le that does not have write permission set and if standard input is a tty, mv
displays the permission code of the le to be overwritten and reads one line from standard input.
If the line begins with y, or the locales equivalent of a y, the move takes place and the le is
overwritten. If not, mv does nothing with the le.
When you use mv to move a directory into an existing directory, the directory and its contents
are added under the existing directory.
If a mv operation fails, mv generally writes a diagnostic message to standard error, does nothing
more with the current source le, and goes on to process any remaining source les.
If the copying or removal of a le is prematurely terminated by a signal or error, mv might leave
a partial copy of the le at either the source or the target pathname. The mv program will not
modify both the source and target pathnames simultaneously; therefore, program termination at
any point always leaves either the source le or the target le complete.
626 Hewlett-Packard Company 527188-004