Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)
mv(1) OSS Shell and Utilities Reference Manual
NAME
mv - Moves files and directories
SYNOPSIS
mv [-i | f] file1 file2
mv [-i | f] file1 ... directory
mv [ -W NOG ][-W NOE ][-i | f] directory1 ... destination_directory
The mv command moves files from one directory to another or renames files and directories.
FLAGS
-f Overrides the -i flag and any mode restrictions. If both
-f and -i are specified (for
example, because an alias includes one of them) whichever appears last overrides the
other.
-i Prompts you with the name of the file followed by a question mark whenever a move is
to supercede an existing file. If the answer begins with y, or the locale’s equivalent of a
y, the move continues. Any other reply prevents the move from occurring. If both -f
and -i are specified (for example, because an alias includes one of them) whichever
appears last overrides the other.
HP Extensions
-W NOG Specifies that the /G directory should be omitted when the initial directory is
root. This flag is ignored when the initial directory is not /, /E,or/E/system.
-W NOE Specifies that the /E directory should be omitted when the initial directory is
root. This flag is ignored when the initial directory is not root.
Specify both the -W NOG and -W NOE flags to omit both the /G and /E directories.
DESCRIPTION
If you move a file to a new directory, mv retains the original filename. When you move a file, all
other links to the file remain intact.
In the second form, one or more files are moved to directory with their original filenames. 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 file onto itself.
When you use mv to rename a file, the target file can be either a new filename or a new directory
pathname. If moving the file would overwrite an existing file, the existing file is overwritten
unless you specify the -i flag, in which case you will be prompted. If moving the file would
overwrite an existing file that does not have write permission set and if standard input is a tty, mv
displays the permission code of the file to be overwritten and reads one line from standard input.
If the line begins with y, or the locale’s equivalent of a y, the move takes place and the file is
overwritten. If not, mv does nothing with the file.
When you use mv to move a directory into an existing directory, the directory and its contents
are added under the existing directory.
If the access permissions of the destination_directory or the existing destination file (file2) forbid |
writing, the mv command asks the issuer of the command for permission to overwrite the file:
1. The mv command prints the mode (see "Access Control Lists (ACLs)," in this reference |
page, and the chmod(1) reference page) followed by the first letters of the words yes and |
no in the language of the current locale, to standard output, prompting for a response.
6−26 Hewlett-Packard Company 527188-007