HPUX mv[1]

mv(1) mv(1)
NAME
mv - move or rename files and directories
SYNOPSIS
mv [-f|-i] file1 new_file
mv [-f|-i] file1 [file2 ...] dest_directory
mv [-f|-i] directory1 [directory2 ...] dest_directory
DESCRIPTION
mv moves:
o file1 to new or existing new_file,
o file1 to existing dest_directory,
o Multiple files file1, file2, ... to existing dest_directory,
o directory subtree directory1, to new or existing
dest_directory. or
o multiple directory subtrees directory1, directory2, ... to
new or existing dest_directory.
Moving file1 to new_file is used to relocate a file within the file
system or to rename a file within a directory. When 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 Control Lists below), followed by the first
letters of the words yes and no in the current native language,
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 pathnames 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
Hewlett-Packard Company - 1 - HP-UX Release 9.0: August 1992
mv(1) mv(1)
response from the standard input is affirmative, the file is
moved if permissions allow the move.
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.
If new_file is a new file, it inherits the access control list of
file1, altered to reflect any difference in ownership between the two
files (see acl(5)).
EXTERNAL INFLUENCES
Environment Variables
LC_CTYPE determines the interpretation of text as single and/or
multi-byte characters.
LANG and LC_CTYPE determine the local language equivalent of y (for
yes/no queries).
LANG determines the language in which messages are displayed.
If LC_CTYPE is not specified in the environment or is set to the empty
string, the value of LANG is used as a default for each unspecified or
empty variable. If LANG is not specified or is set to the empty
string, a default of "C" (see lang(5)) is used instead of LANG. If
any internationalization variable contains an invalid setting, mv
behaves as if all internationalization variables are set to "C". See
environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
EXAMPLES
Rename a file in the current directory:
mv old_filename new_filename
Rename a directory in the current directory:
mv old_dirname new_dirname
Rename a file in the current directory whose name starts with a non-
printing control character, -, *, or some other character that is
special to the shell (extra care may be required, depending on the
situation):
mv ./ bad_filename new_filename
mv ./? bad_filename new_filename
mv ./* bad_filename new_filename
Hewlett-Packard Company - 2 - HP-UX Release 9.0: August 1992
mv(1) mv(1)
Move directory sourcedir and its contents to a new location
(targetdir) in the file system (upon completion, a subdirectory named
sourcedir resides in directory targetdir):
mv sourcedir targetdir
Move all files and directories (including links) in current directory
to a new location underneath targetdir:
mv * targetdir
Move all files and directories (including links) in sourcedir to a new
location underneath targetdir (sourcedir and targetdir are in separate
directory paths):
mv sourcedir/* targetdir
WARNINGS
If file1 and new_file exist on different file systems, mv copies the
file and deletes the original. In this case the mover becomes the
owner and any linking relationship with other files is lost. mv
cannot carry hard links across file systems.
mv cannot be used to perform the following operations:
o Rename either the current working directory or its parent
directory using the . or .. notation,
o Rename a directory to a new name identical to the name of a
file contained in the same parent directory.
Access Control Lists
Access control list descriptions in this entry apply only to standard
HP-UX operating systems. If HP-UX BLS software has been installed,
access control lists are handled differently. Refer to HP-UX BLS
documentation for information about access control lists in the HP-UX
BLS environment.
DEPENDENCIES
NFS Access control lists of networked files are summarized (as
returned in st_mode by stat(2)), but not copied to the new file.
When using mv on such files, a + is not printed after the mode
value when asking for permission to overwrite a file.
AUTHOR
mv was developed by AT&T, the University of California, Berkeley and
HP.
SEE ALSO
cp(1), cpio(1), ln(1), rm(1), link(1M), lstat(2), readlink(2),
stat(2), symlink(2), symlink(4), acl(5).
Hewlett-Packard Company - 3 - HP-UX Release 9.0: August 1992
mv(1) mv(1)
STANDARDS CONFORMANCE
mv: SVID2, XPG2, XPG3, POSIX.2
Hewlett-Packard Company - 4 - HP-UX Release 9.0: August 1992