*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> mv (1)              
Title
Content
Arch
Section
 

Contents


 mv(1)                                                                 mv(1)




 NAME    [Toc]    [Back]
      mv - move or rename files and directories

 SYNOPSIS    [Toc]    [Back]
      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    [Toc]    [Back]
      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 Control 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    [Toc]    [Back]
      mv recognizes the following options:

           -f             Perform mv commands without prompting for
                          permission.  This option is assumed when the



 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003






 mv(1)                                                                 mv(1)




                          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)    [Toc]    [Back]
      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) and aclv(5)).  In JFS file systems, new files
      created by mv do not inherit their parent directory's default ACL
      entries (if any), but instead retain their original ACLs.  When moving
      files from a JFS file system to an HFS file system or vice versa,
      optional ACL entries are lost.





 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003






 mv(1)                                                                 mv(1)




 EXTERNAL INFLUENCES    [Toc]    [Back]
    Environment Variables
      LC_CTYPE determines the interpretation of text as single byte and/or
      multibyte 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    [Toc]    [Back]
      Single character and multibyte character code sets are supported.

 EXAMPLES    [Toc]    [Back]
      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
      nonprinting control character or a character that is special to the
      shell, such as - and * (extra care may be required depending on the
      situation):

           mv ./bad-filename new-filename
           mv ./?bad-filename new-filename
           mv ./*bad-filename new-filename

      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 the current
      directory to a new location underneath targetdir:

           mv * targetdir





 Hewlett-Packard Company            - 3 -   HP-UX 11i Version 2: August 2003






 mv(1)                                                                 mv(1)




      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    [Toc]    [Back]
      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.  If file1 is a directory,
      mv copies the entire directory structure onto the destination file
      system and deletes the original.

      mv cannot be used to perform the following operations:

           +  Rename either the current working directory or its parent
              directory using the .  or ..  notation.

           +  Rename a directory to a new name identical to the name of a
              file contained in the same parent directory.

 DEPENDENCIES    [Toc]    [Back]
    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    [Toc]    [Back]
      mv was developed by AT&T, the University of California, Berkeley and
      HP.

 SEE ALSO    [Toc]    [Back]
      cp(1), cpio(1), ln(1), rm(1), link(1M), lstat(2), readlink(2),
      stat(2), symlink(2), symlink(4), acl(5), aclv(5).

 STANDARDS CONFORMANCE    [Toc]    [Back]
      mv: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2


 Hewlett-Packard Company            - 4 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
mv Linux move (rename) files
lifrename HP-UX rename LIF files
mv FreeBSD move files
mv OpenBSD move files
dh_movefiles Linux move files out of debian/tmp into subpackages
cp IRIX copy, link or move files
ln HP-UX link files and directories
install IRIX install files in directories
dosrm HP-UX remove DOS files or directories
rm HP-UX remove files or directories
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service