MV(1) BSD Reference Manual MV(1)
S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
m
\bmv
\bv [-
\b-f
\bf | -
\b-i
\bi] _
\bs_
\bo_
\bu_
\br_
\bc_
\be _
\bt_
\ba_
\br_
\bg_
\be_
\bt
m
\bmv
\bv [-
\b-f
\bf | -
\b-i
\bi] _
\bs_
\bo_
\bu_
\br_
\bc_
\be _
\b._
\b._
\b. _
\bs_
\bo_
\bu_
\br_
\bc_
\be _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bo_
\br_
\by
D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
In its first form, the m
\bmv
\bv utility renames the file named by the _
\bs_
\bo_
\bu_
\br_
\bc_
\be
operand to the destination path named by the _
\bt_
\ba_
\br_
\bg_
\be_
\bt operand. This form
is assumed when the last operand does not name an already existing direc-
In its second form, m
\bmv
\bv moves each file named by a _
\bs_
\bo_
\bu_
\br_
\bc_
\be operand to a
destination file in the existing directory named by the _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bo_
\br_
\by
operand. The destination path for each operand is the pathname produced
by the concatenation of the last operand, a slash, and the final pathname
component of the named file.
The following options are available:
-
\b-f
\bf Do not prompt for confirmation before overwriting the destination
path. (The -
\b-i
\bi option is ignored if the -
\b-f
\bf option is specified.)
-
\b-i
\bi Causes m
\bmv
\bv to write a prompt to standard error before moving a file
that would overwrite an existing file. If the response from the
standard input begins with the character ``y'', the move is at-
It is an error for either the _
\bs_
\bo_
\bu_
\br_
\bc_
\be operand or the destination path to
specify a directory unless both do.
If the destination path does not have a mode which permits writing, m
\bmv
\bv
prompts the user for confirmation as specified for the -
\b-i
\bi option.
As the rename(2) call does not work across file systems, m
\bmv
\bv uses cp(1)
and rm(1) to accomplish the move. The effect is equivalent to:
rm -f destination_path && \
cp -pr source_file destination && \
The m
\bmv
\bv utility exits 0 on success, and >0 if an error occurs.
S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
S
\bST
\bTA
\bAN
\bND
\bDA
\bAR
\bRD
\bDS
\bS
The m
\bmv
\bv utility is expected to be IEEE Std1003.2 (``POSIX'') compatible.