|
|
1.1 root 1: .\" Copyright (c) 1989, 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)mv.1 6.5 (Berkeley) 7/24/90
19: .\"
20: .Dd July 24, 1990
21: .Dt MV 1
22: .Os BSD 4.4
23: .Sh NAME
24: .Nm mv
25: .Nd move files
26: .Sh SYNOPSIS
27: .Nm mv
28: .Op Fl f Li \&| Fl i
29: .Ar source target
30: .Nm mv
31: .Op Fl f Li \&| Fl i
32: .Ar source ... source directory
33: .De
34: .Sh DESCRIPTION
35: .Pp
36: In its first form, the
37: .Nm mv
38: utility renames the file named by the
39: .Ar source
40: operand to the destination path named by the
41: .Ar target
42: operand.
43: This form is assumed when the last operand does not name an already
44: existing directory.
45: .Pp
46: In its second form,
47: .Nm mv
48: moves each file named by a
49: .Ar source
50: operand to a destination file in the existing directory named by the
51: .Ar directory
52: operand.
53: The destination path for each operand is the pathname produced by the
54: concatenation of the last operand, a slash, and the final pathname
55: component of the named file.
56: .Pp
57: The following options are available:
58: .Tw Ds
59: .Tp Fl f
60: Do not prompt for confirmation before overwriting the destination
61: path.
62: (The
63: .Fl i
64: option is ignored if the
65: .Fl f
66: option is specified.)
67: .Tp Fl i
68: Causes
69: .Nm mv
70: to write a prompt to standard error before moving a file that would
71: overwrite an existing file.
72: If the response from the standard input begins with the character ``y'',
73: the move is attempted.
74: .Tp
75: .Pp
76: It is an error for either the
77: .Ar source
78: operand or the destination path to specify a directory unless both do.
79: .Pp
80: If the destination path does not have a mode which permits writing,
81: .Nm mv
82: prompts the user for confirmation as specified for the
83: .Fl i
84: option.
85: .Pp
86: As the
87: .Xr rename 2
88: call does not work across file systems,
89: .Nm mv
90: uses
91: .Xr cp 1
92: and
93: .Xr rm 1
94: to accomplish the move.
95: The effect is equivalent to:
96: .Pp
97: .Ds I
98: rm -f destination_path && \e
99: \tcp -pr source_file destination && \e
100: \trm -rf source_file
101: .De
102: .Pp
103: The
104: .Nm mv
105: utility exits 0 on success, and >0 if an error occurs.
106: .Sh SEE ALSO
107: .Xr cp 1
108: .Sh STANDARDS
109: The
110: .Nm mv
111: function is expected to be POSIX 1003.2 compatible.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.