19ddb49cbSWarner Losh.\"- 24b88c807SRodney W. Grimes.\" Copyright (c) 1989, 1990, 1993 34b88c807SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 44b88c807SRodney W. Grimes.\" 54b88c807SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 64b88c807SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc. 74b88c807SRodney W. Grimes.\" 84b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 94b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions 104b88c807SRodney W. Grimes.\" are met: 114b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 124b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 134b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 144b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 154b88c807SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 16*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 174b88c807SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 184b88c807SRodney W. Grimes.\" without specific prior written permission. 194b88c807SRodney W. Grimes.\" 204b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 214b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 224b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 234b88c807SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 244b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 254b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 264b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 274b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 284b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 294b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 304b88c807SRodney W. Grimes.\" SUCH DAMAGE. 314b88c807SRodney W. Grimes.\" 32e9e3a1abSJoel Dahl.Dd March 15, 2013 334b88c807SRodney W. Grimes.Dt MV 1 344b88c807SRodney W. Grimes.Os 354b88c807SRodney W. Grimes.Sh NAME 364b88c807SRodney W. Grimes.Nm mv 374b88c807SRodney W. Grimes.Nd move files 384b88c807SRodney W. Grimes.Sh SYNOPSIS 39be8b1497SRuslan Ermilov.Nm 40ca38f0ddSRuslan Ermilov.Op Fl f | i | n 416ce6b6c1SJohn Baldwin.Op Fl hv 424b88c807SRodney W. Grimes.Ar source target 43be8b1497SRuslan Ermilov.Nm 44ca38f0ddSRuslan Ermilov.Op Fl f | i | n 4546fedeb0SMichael Haro.Op Fl v 46af6ff028SWolfgang Helbig.Ar source ... directory 474b88c807SRodney W. Grimes.Sh DESCRIPTION 484b88c807SRodney W. GrimesIn its first form, the 49c9a8d1f4SPhilippe Charnier.Nm 504b88c807SRodney W. Grimesutility renames the file named by the 514b88c807SRodney W. Grimes.Ar source 524b88c807SRodney W. Grimesoperand to the destination path named by the 534b88c807SRodney W. Grimes.Ar target 544b88c807SRodney W. Grimesoperand. 554b88c807SRodney W. GrimesThis form is assumed when the last operand does not name an already 564b88c807SRodney W. Grimesexisting directory. 574b88c807SRodney W. Grimes.Pp 584b88c807SRodney W. GrimesIn its second form, 59c9a8d1f4SPhilippe Charnier.Nm 604b88c807SRodney W. Grimesmoves each file named by a 614b88c807SRodney W. Grimes.Ar source 624b88c807SRodney W. Grimesoperand to a destination file in the existing directory named by the 634b88c807SRodney W. Grimes.Ar directory 644b88c807SRodney W. Grimesoperand. 654b88c807SRodney W. GrimesThe destination path for each operand is the pathname produced by the 664b88c807SRodney W. Grimesconcatenation of the last operand, a slash, and the final pathname 674b88c807SRodney W. Grimescomponent of the named file. 684b88c807SRodney W. Grimes.Pp 694b88c807SRodney W. GrimesThe following options are available: 70ca38f0ddSRuslan Ermilov.Bl -tag -width indent 714b88c807SRodney W. Grimes.It Fl f 724b88c807SRodney W. GrimesDo not prompt for confirmation before overwriting the destination 734b88c807SRodney W. Grimespath. 744b88c807SRodney W. Grimes(The 75d7e0e5caSWolfram Schneider.Fl f 765fd463acSWolfram Schneideroption overrides any previous 775fd463acSWolfram Schneider.Fl i 78dce742c5SDavid E. O'Brienor 79dce742c5SDavid E. O'Brien.Fl n 805fd463acSWolfram Schneideroptions.) 816ce6b6c1SJohn Baldwin.It Fl h 826ce6b6c1SJohn BaldwinIf the 836ce6b6c1SJohn Baldwin.Ar target 846ce6b6c1SJohn Baldwinoperand is a symbolic link to a directory, 856ce6b6c1SJohn Baldwindo not follow it. 866ce6b6c1SJohn BaldwinThis causes the 876ce6b6c1SJohn Baldwin.Nm 886ce6b6c1SJohn Baldwinutility to rename the file 896ce6b6c1SJohn Baldwin.Ar source 906ce6b6c1SJohn Baldwinto the destination path 916ce6b6c1SJohn Baldwin.Ar target 926ce6b6c1SJohn Baldwinrather than moving 936ce6b6c1SJohn Baldwin.Ar source 946ce6b6c1SJohn Baldwininto the directory referenced by 956ce6b6c1SJohn Baldwin.Ar target . 964b88c807SRodney W. Grimes.It Fl i 97c9a8d1f4SPhilippe CharnierCause 98c9a8d1f4SPhilippe Charnier.Nm 994b88c807SRodney W. Grimesto write a prompt to standard error before moving a file that would 1004b88c807SRodney W. Grimesoverwrite an existing file. 1015fd463acSWolfram SchneiderIf the response from the standard input begins with the character 102ca38f0ddSRuslan Ermilov.Ql y 1035fd463acSWolfram Schneideror 104ca38f0ddSRuslan Ermilov.Ql Y , 1054b88c807SRodney W. Grimesthe move is attempted. 1065fd463acSWolfram Schneider(The 1075fd463acSWolfram Schneider.Fl i 1085fd463acSWolfram Schneideroption overrides any previous 1095fd463acSWolfram Schneider.Fl f 110dce742c5SDavid E. O'Brienor 111dce742c5SDavid E. O'Brien.Fl n 112dce742c5SDavid E. O'Brienoptions.) 113dce742c5SDavid E. O'Brien.It Fl n 11499479039SGiorgos KeramidasDo not overwrite an existing file. 115dce742c5SDavid E. O'Brien(The 116dce742c5SDavid E. O'Brien.Fl n 117dce742c5SDavid E. O'Brienoption overrides any previous 118dce742c5SDavid E. O'Brien.Fl f 119dce742c5SDavid E. O'Brienor 120dce742c5SDavid E. O'Brien.Fl i 1215fd463acSWolfram Schneideroptions.) 12246fedeb0SMichael Haro.It Fl v 12346fedeb0SMichael HaroCause 12446fedeb0SMichael Haro.Nm 12546fedeb0SMichael Haroto be verbose, showing files after they are moved. 1264b88c807SRodney W. Grimes.El 1274b88c807SRodney W. Grimes.Pp 128a3f58daeSPav LucistnikIt is an error for the 1294b88c807SRodney W. Grimes.Ar source 130a3f58daeSPav Lucistnikoperand to specify a directory if the target exists and is not a directory. 1314b88c807SRodney W. Grimes.Pp 1324b88c807SRodney W. GrimesIf the destination path does not have a mode which permits writing, 133c9a8d1f4SPhilippe Charnier.Nm 1344b88c807SRodney W. Grimesprompts the user for confirmation as specified for the 1354b88c807SRodney W. Grimes.Fl i 1364b88c807SRodney W. Grimesoption. 1374b88c807SRodney W. Grimes.Pp 1384b88c807SRodney W. GrimesAs the 1394b88c807SRodney W. Grimes.Xr rename 2 1404b88c807SRodney W. Grimescall does not work across file systems, 141c9a8d1f4SPhilippe Charnier.Nm 1424b88c807SRodney W. Grimesuses 1434b88c807SRodney W. Grimes.Xr cp 1 1444b88c807SRodney W. Grimesand 1454b88c807SRodney W. Grimes.Xr rm 1 1464b88c807SRodney W. Grimesto accomplish the move. 1474b88c807SRodney W. GrimesThe effect is equivalent to: 1484b88c807SRodney W. Grimes.Bd -literal -offset indent 1494b88c807SRodney W. Grimesrm -f destination_path && \e 150ca38f0ddSRuslan Ermilovcp -pRP source_file destination && \e 151ca38f0ddSRuslan Ermilovrm -rf source_file 1524b88c807SRodney W. Grimes.Ed 1536fca4c7cSRuslan Ermilov.Sh EXIT STATUS 154d628d776SRuslan Ermilov.Ex -std 155e9e3a1abSJoel Dahl.Sh EXAMPLES 156e9e3a1abSJoel DahlRename file 157e9e3a1abSJoel Dahl.Pa foo 158e9e3a1abSJoel Dahlto 159e9e3a1abSJoel Dahl.Pa bar , 160e9e3a1abSJoel Dahloverwriting 161e9e3a1abSJoel Dahl.Pa bar 162e9e3a1abSJoel Dahlif it already exists: 163e9e3a1abSJoel Dahl.Pp 164e9e3a1abSJoel Dahl.Dl $ mv -f foo bar 165234c2f5bSMichael Haro.Sh COMPATIBILITY 166234c2f5bSMichael HaroThe 1676ce6b6c1SJohn Baldwin.Fl h , 1686ce6b6c1SJohn Baldwin.Fl n , 16912767b84SDavid E. O'Brienand 170234c2f5bSMichael Haro.Fl v 17112767b84SDavid E. O'Brienoptions are non-standard and their use in scripts is not recommended. 1726fca4c7cSRuslan Ermilov.Sh SEE ALSO 1736fca4c7cSRuslan Ermilov.Xr cp 1 , 1746fca4c7cSRuslan Ermilov.Xr rm 1 , 1756fca4c7cSRuslan Ermilov.Xr symlink 7 1764b88c807SRodney W. Grimes.Sh STANDARDS 1774b88c807SRodney W. GrimesThe 178c9a8d1f4SPhilippe Charnier.Nm 1794b88c807SRodney W. Grimesutility is expected to be 1804b88c807SRodney W. Grimes.St -p1003.2 1814b88c807SRodney W. Grimescompatible. 182b8923d4cSWolfram Schneider.Sh HISTORY 183b8923d4cSWolfram SchneiderA 184b8923d4cSWolfram Schneider.Nm 185b8923d4cSWolfram Schneidercommand appeared in 186b8923d4cSWolfram Schneider.At v1 . 187