mv(1)

mv(1)

NAME

mv - move or rename ®les and directories

SYNOPSIS

mv [-f-i][-eextarg] ®le1 new-®le

mv [-f-i][-eextarg] ®le1 [®le2 ...] dest-directory

mv [-f-i][-eextarg] directory1 [ directory2 ... ] dest-directory

DESCRIPTION

The mv command moves:

One ®le (®le1) to a new or existing ®le (new-®le).

One or more ®les (®le1, [®le2, ...]) to an existing directory (dest-directory).

One or more directory subtrees (directory1, [directory2, ...]) to a new or existing directory (dest- directory).

Moving ®le1 to new-®leis used to rename a ®le within a directory or to relocate a ®le within a ®le system or across different ®le systems. When the destination is a directory, one or more ®les are moved into that directory. If two or more ®les are moved, the destination must be a directory. When moving a single ®le to a new ®le, if new-®leexists, its contents are destroyed.

If the access permissions of the destination dest-directoryor existing destination ®le new-®leforbid writing, mv asks permission to overwrite the ®le. This is done by printing the mode (see chmod(2) and Access Control Lists below), followed by the ®rst 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 af®rmative and the action is permissible, the operation occurs; if not, the command proceeds to the next source ®le, if any.

If ®le1 is a ®le and new-®leis a link to another ®le with other links, the other links remain and new-®lebecomes a new ®le. If ®le1 is a ®le with links or a link to a ®le, the existing ®le or link remains intact, but the name is changed to new-®lewhich may or may not be in the directory where ®le1 resided, depending on directory path names used in the mv command. The last access and modi®cation times of the ®le or ®les 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 ®le that would

 

overwrite an existing ®le. If the response from the standard input is af®rmative, the

 

®le is moved if permissions allow the move.

-eextarg

Speci®es the handling of any extent attributes of the ®les(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 ®le anyway.

 

ignore

Do not preserve extent attributes.

 

force

Do not move the ®le if the extent attributes cannot be preserved.

 

 

If multiple source ®les are speci®ed with a single target directory, mv will

move the ®les that either do not have extent attributes or that have extent attributes that can be preserved. mv will not move the ®les if it cannot preserve their extent attributes.

Extent attributes cannot be preserved if the ®les are being moved to a ®le system that does not support extent attributes or if that ®le system has a different block size than the original. If -eis not speci®ed, the default value for extarg is warn.

Access Control Lists (ACLs)

If optional ACL entries are associated with new-®le, mv displays a plus sign (+) after the access mode when asking permission to overwrite the ®le.

HP-UX Release 11i: December 2000

− 1 −

Section 1553

m