1.\" Copyright (c) 1989, 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)mv.1 6.7 (Berkeley) 03/14/91 7.\" 8.Vx 9.Vx 10.Dd 11.Dt MV 1 12.Os 13.Sh NAME 14.Nm mv 15.Nd move files 16.Sh SYNOPSIS 17.Nm mv 18.Op Fl f Li \&| Fl i 19.Ar source target 20.Nm mv 21.Op Fl f Li \&| Fl i 22.Ar source ... source directory 23.De 24.Sh DESCRIPTION 25.Pp 26In its first form, the 27.Nm mv 28utility renames the file named by the 29.Ar source 30operand to the destination path named by the 31.Ar target 32operand. 33This form is assumed when the last operand does not name an already 34existing directory. 35.Pp 36In its second form, 37.Nm mv 38moves each file named by a 39.Ar source 40operand to a destination file in the existing directory named by the 41.Ar directory 42operand. 43The destination path for each operand is the pathname produced by the 44concatenation of the last operand, a slash, and the final pathname 45component of the named file. 46.Pp 47The following options are available: 48.Tw Ds 49.Tp Fl f 50Do not prompt for confirmation before overwriting the destination 51path. 52(The 53.Fl i 54option is ignored if the 55.Fl f 56option is specified.) 57.Tp Fl i 58Causes 59.Nm mv 60to write a prompt to standard error before moving a file that would 61overwrite an existing file. 62If the response from the standard input begins with the character ``y'', 63the move is attempted. 64.Tp 65.Pp 66It is an error for either the 67.Ar source 68operand or the destination path to specify a directory unless both do. 69.Pp 70If the destination path does not have a mode which permits writing, 71.Nm mv 72prompts the user for confirmation as specified for the 73.Fl i 74option. 75.Pp 76As the 77.Xr rename 2 78call does not work across file systems, 79.Nm mv 80uses 81.Xr cp 1 82and 83.Xr rm 1 84to accomplish the move. 85The effect is equivalent to: 86.Pp 87.Ds I 88rm -f destination_path && \e 89\tcp -pr source_file destination && \e 90\trm -rf source_file 91.De 92.Pp 93The 94.Nm mv 95utility exits 0 on success, and >0 if an error occurs. 96.Sh SEE ALSO 97.Xr cp 1 98.Sh STANDARDS 99The 100.Nm mv 101function is expected to be POSIX 1003.2 compatible. 102