Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
m
mv(1) mv(1)
NAME
mv - move or rename files and directories
SYNOPSIS
mv [-f-i][-e extarg] file1 new-file
mv [-f-i][-e extarg] file1 [file2 ...] dest-directory
mv [-f-i][-e extarg] directory1 [directory2 ... ] dest-directory
DESCRIPTION
The mv command moves:
• One file (file1) to a new or existing file (new-file).
• One or more files (file1,[file2, ...]) to an existing directory (dest-directory).
• One or more directory subtrees (directory1,[directory2, ...]) to a new or existing directory (dest-
directory).
Moving file1 to new-file is used to rename a file within a directory or to relocate a file within a file system or
across different file systems. When the destination is a directory, one or more files are moved into that
directory. If two or more files are moved, the destination must be a directory. When moving a single file to
a new file, if new-file exists, its contents are destroyed.
If the access permissions of the destination dest-directory or existing destination file new-file forbid writing,
mv asks permission to overwrite the file. This is done by printing the mode (see chmod(2) and Access Con-
trol Lists below), followed by the first letters of the words yes and no in the language of the current locale,
prompting for a response, and reading one line from the standard input. If the response is affirmative and
the action is permissible, the operation occurs; if not, the command proceeds to the next source file, if any.
If file1 is a file and new-file is a link to another file with other links, the other links remain and new-file
becomes a new file. If file1 is a file with links or a link to a file, the existing file or link remains intact, but
the name is changed to new-file which may or may not be in the directory where file1 resided, depending on
directory path names used in the
mv command. The last access and modification times of the file or files
being moved remain unchanged.
Options
mv recognizes the following options:
-f Perform mv commands without prompting for permission. This option is assumed
when the standard input is not a terminal.
-i Causes mv to write a prompt to standard output before moving a file that would
overwrite an existing file. If the response from the standard input is affirmative, the
file is moved if permissions allow the move.
-e extarg Specifies the handling of any extent attributes of the files(s) to be moved. extarg can
be one of the following values:
warn Issue a warning message if extent attributes cannot be preserved, but
move the file anyway.
ignore Do not preserve extent attributes.
force Do not move the file if the extent attributes cannot be preserved.
If multiple source files are specified with a single target directory, mv will
move the files that either do not have extent attributes or that have
extent attributes that can be preserved.
mv will not move the files if it
cannot preserve their extent attributes.
Extent attributes cannot be preserved if the files are being moved to a file system that
does not support extent attributes or if that file system has a different block size than
the original. If -e is not specified, the default value for extarg is warn.
Access Control Lists (ACLs)
If optional ACL entries are associated with new-file, mv displays a plus sign (
+) after the access mode when
asking permission to overwrite the file.
HP-UX Release 11i: December 2000 − 1 − Section 1−−553
___
___