Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mv(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod

ln

rm

rename

mv

PURPOSE

     Moves files.

SYNOPSIS
     mv [ -f ] file1 [ file2 ... ] target


DESCRIPTION

     Warning:  The mv command may  overwrite many files if you
     do not ensure that the file path names you are specifying
     do not already exist.

     The mv (move)  command moves files 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.

     You can only rename a  directory with mv; you cannot move
     it.   Both  directory  and  newname must  have  the  same
     parent.  All  files in  directory are  moved to  a newly-
     created directory newname under the same file names.

     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.

     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.

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" already exists,  then an error message
         is displayed.
     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 existing directories,  and Example 4
     names a file and a directory.
     5.  To move several files into another directory:

           mv  chap4  jim/chap5  /u/manual

         This   moves   "chap4"   to   "/u/manual/chap4"   and
         "jim/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".
         Note that you must type  a space between the star and
         the period.

RELATED INFORMATION

     The following commands:  "chmod," "ln," and  "rm."

     The rename system call  in AIX Operating System Technical
     Reference.

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