GNU Info

Info Node: ( invocation

( invocation

Next: rm invocation Prev: install invocation Up: Basic operations
Enter node , (file) or (file)node

`mv': Move (rename) files

   `mv' moves or renames files (or directories).  Synopsis:


   If the last argument names an existing directory, `mv' moves each
other given file into a file with the same name in that directory.
Otherwise, if only two files are given, it renames the first as the
second.  It is an error if the last argument is not a directory and
more than two files are given.

   `mv' can move any type of file from one filesystem to another.
Prior to version `4.0' of the fileutils, `mv' could move only regular
files between filesystems.  For example, now `mv' can move an entire
directory hierarchy including special device files from one partition
to another.  It first uses some of the same code that's used by `cp -a'
to copy the requested directories and files, then (assuming the copy
succeeded) it removes the originals.  If the copy fails, then the part
that was copied to the destination partition is removed.  If you were
to copy three directories from one partition to another and the copy of
the first directory succeeded, but the second didn't, the first would
be left on the destination partion and the second and third would be
left on the original partition.

   If a destination file exists but is normally unwritable, standard
input is a terminal, and the `-f' or `--force' option is not given,
`mv' prompts the user for whether to replace the file.  (You might own
the file, or have write permission on its directory.)  If the response
does not begin with `y' or `Y', the file is skipped.

   _Warning_: If you try to move a symlink that points to a directory,
and you specify the symlink with a trailing slash, then `mv' doesn't
move the symlink but instead moves the directory referenced by the
symlink.  Note: Trailing slashes.

   The program accepts the following options.  Also see Note: Common

     Note: Backup options.  Make a backup of each file that would
     otherwise be overwritten or removed.

     Do not prompt the user before removing an unwritable destination

     Prompt whether to overwrite each existing destination file,
     regardless of its permissions.  If the response does not begin
     with `y' or `Y', the file is skipped.

     Do not move a nondirectory that has an existing destination with
     the same or newer modification time.

     Print the name of each file before moving it.

     Remove any trailing slashes from each SOURCE argument.  Note:
     Trailing slashes.

     Append SUFFIX to each backup file made with `-b'.  Note: Backup

     Specify the destination DIRECTORY.  Note: Target directory.

     Change the type of backups made with `-b'.  The METHOD argument
     can be `none' (or `off'), `numbered' (or `t'), `existing' (or
     `nil'), or `never' (or `simple').  Note: Backup options.

automatically generated by info2www version