Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mv(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod

ln

rm, delete

rename



MV, MOVE(1,C)               AIX Commands Reference                MV, MOVE(1,C)



-------------------------------------------------------------------------------
mv, move



PURPOSE

Moves files.

SYNTAX


 one of                 +--- file --- directory ------+
+------+   +--------+   | ^        |                  |
| mv   |---| +----+ |---| +--------+                  |---|
| move |   +-| -f |-+   |    one of                   |
+------+    ^| -i ||    | +-----------+               |
            || -- ||    +-| file      |--- newname ---+
            |+----+|      | directory |
            +------+      +-----------+


DESCRIPTION

Warning: The mv command may overwrite existing files unless -i is specified to
prompt the user.

The mv (move) command moves files or directories from one directory to another,
or it renames a file or directory.  If you move a file to a new directory, it
retains the base file name.  When you move a file, all links to other files
remain intact, except when you move it to a different file system.

When you use mv to rename a file, then newname can specify either a new file
name or a new directory path name.  If moving the file would overwrite an
existing write-protected file and if standard input is a work station, mv
displays the permission code of the file to be overwritten and reads one line
from standard input.  If the line begins with "y", the move takes place and the
file is overwritten.  If not, mv does nothing with the file.

If file is a symbolic link, the symbolic link is unlinked and a new symbolic
link is created.  If newname is a symbolic link and it points to a directory,
file is moved to the directory.  If newname is a symbolic link and it points to
a file, the symbolic link is removed and file is renamed to newname.  If
newname is a symbolic link that points to a non-existent file, and standard
input is a work station, mv displays the permission code of the symbolic link
and reads one line from standard input.  If the line begins with y, the
symbolic link is removed and file is renamed to newname; otherwise mv does
nothing.

The file may reference a hidden directory, but the "@" notation must be used.
Moving individual components of hidden directories must be done by identifying
them explicitly.



Processed November 8, 1990       MV, MOVE(1,C)                                1





MV, MOVE(1,C)               AIX Commands Reference                MV, MOVE(1,C)




Note:  If the file is on different file system than directory, mv must copy the
       file to the new file system and delete the original.  In this case, the
       owner name becomes that of the user, and all links to other files are
       lost.

FLAGS

-f   Does not prompt before removing a write-protected file.  This also
     overrides the -i flag.

-i   Whenever an existing file is to be overwritten, the user is prompted by
     the name of the file followed by a question mark (?).  If a line starting
     with y is entered, the move takes place.  Any other reply prevents the
     move from occurring.

--   Interprets all the following arguments to mv as file names.  This allows
     file names starting with minus signs.

EXAMPLES

  1. To rename a file:

      mv  appendix  apndx.a

    This renames "appendix" to "apndx.a".  If a file named "apndx.a" already
    exists, its old contents are replaced with those of "appendix".

  2. To rename a directory:

      mv  book  manual

    This renames "book" to "manual".  If a directory named "manual" exists, the
    directory book becomes a subdirectory of manual.

  3. To move a file to another directory and give it a new name:

      mv  intro  manual/chap1

    This moves "intro" to "manual/chap1".  The name "intro" is removed from the
    current directory, and the same file appears as "chap1" in the directory
    "manual".

  4. To move a file to another directory, keeping the same name:

      mv  chap3  manual

    This moves "chap3" to "manual/chap3".

Note the difference:  Examples 1 and 3 name two files, Example 2 names two
directories, and Example 4 names a file and a directory.




Processed November 8, 1990       MV, MOVE(1,C)                                2





MV, MOVE(1,C)               AIX Commands Reference                MV, MOVE(1,C)



  5. To move several files into another directory:

      mv  chap4  tom/chap5  /u/manual

    This moves "chap4" to "/u/manual/chap4" and "tom/chap5" to
    "/u/manual/chap5".

  6. To use mv with pattern-matching characters:

      mv  manual/*  .

    This moves all files in the directory "manual" into the current directory
    (.), giving them the same names they had in "manual".  This also empties
    "manual".  You must type a space between the star and the period.

  7. To use mv to rename hidden directories:

      mv /bin/who@ /bin/OLDwho@

    This renames the whole hidden directory.  Programs that need to access its
    components must use /bin/OLDwho as a command.

  8. To use mv to move components within a hidden directory:

      mv /bin/who@/v1i386 /bin/who@/v2i386

    This moves the v1i386 of the hidden directory to v2i386.

RELATED INFORMATION

See the following commands:  "chmod,"  "ln," and  "rm, delete."

See the rename system call in AIX Operating System Technical Reference.






















Processed November 8, 1990       MV, MOVE(1,C)                                3



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026