ANSI C; sprintf now returns an int.
[unix-history] / usr / src / bin / mv / mv.1
CommitLineData
1c59be2d
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
2c30433e 5.\" @(#)mv.1 6.1 (Berkeley) %G%
1c59be2d 6.\"
2c30433e 7.TH MV 1 ""
1c59be2d
KM
8.UC 4
9.SH NAME
10mv \- move or rename files
11.SH SYNOPSIS
12.B mv
13[
14.B \-i
15] [
16.B \-f
17] [
18.B \-
19] file1 file2
20.PP
21.B mv
22[
23.B \-i
24] [
25.B \-f
26] [
27.B \-
28] file ... directory
29.SH DESCRIPTION
30.I Mv
31moves (changes the name of)
32.I file1
33to
34.IR file2 .
35.PP
36If
37.I file2
4a56fc5a 38already exists, it is removed before
1c59be2d 39.I file1
4a56fc5a 40is moved. If
1c59be2d
KM
41.I file2
42has a mode which forbids writing,
43.I mv
44prints the mode (see
45.IR chmod (2))
4a56fc5a 46and reads the standard input to obtain a line; if the line begins with
1c59be2d 47.B y,
4a56fc5a 48the move takes place; if not,
1c59be2d
KM
49.I mv
50exits.
51.PP
4a56fc5a 52In the second form, one or more
1c59be2d 53.I files
4a56fc5a 54(plain files or directories) are moved to the
1c59be2d 55.I directory
4a56fc5a 56with their original file-names.
1c59be2d
KM
57.PP
58.I Mv
59refuses to move a file onto itself.
60.PP
61Options:
62.TP
63.B \-i
64stands for interactive mode. Whenever a move is to supercede an
65existing file, the user is prompted by the name of the file
66followed by a question mark. If he answers with a line starting
67with 'y', the move continues. Any other reply prevents the move from
68occurring.
69.TP
70.B \-f
71stands for force. This option overrides any mode restrictions or the
72\-i switch.
73.TP
74.B \-
75means interpret all the following arguments to
76.I mv
77as file names. This allows file names starting with minus.
78.SH "SEE ALSO"
79cp(1), ln(1)
80.SH BUGS
81If
82.I file1
83and
84.I file2
85lie on different file systems,
86.I mv
87must copy the file and delete the original.
4a56fc5a
KM
88In this case the owner name becomes that of the copying process and any
89linking relationship with other files is lost.