OSDN Git Service

util-linux 2.38: 翻訳予約。
[linuxjm/jm.git] / manual / util-linux / original / man1 / rename.1
1 '\" t
2 .\"     Title: rename
3 .\"    Author: [see the "AUTHOR(S)" section]
4 .\" Generator: Asciidoctor 2.0.15
5 .\"      Date: 2022-02-17
6 .\"    Manual: User Commands
7 .\"    Source: util-linux 2.38
8 .\"  Language: English
9 .\"
10 .TH "RENAME" "1" "2022-02-17" "util\-linux 2.38" "User Commands"
11 .ie \n(.g .ds Aq \(aq
12 .el       .ds Aq '
13 .ss \n[.ss] 0
14 .nh
15 .ad l
16 .de URL
17 \fI\\$2\fP <\\$1>\\$3
18 ..
19 .als MTO URL
20 .if \n[.g] \{\
21 .  mso www.tmac
22 .  am URL
23 .    ad l
24 .  .
25 .  am MTO
26 .    ad l
27 .  .
28 .  LINKSTYLE blue R < >
29 .\}
30 .SH "NAME"
31 rename \- rename files
32 .SH "SYNOPSIS"
33 .sp
34 \fBrename\fP [options] \fIexpression replacement file\fP...
35 .SH "DESCRIPTION"
36 .sp
37 \fBrename\fP will rename the specified files by replacing the first occurrence of \fIexpression\fP in their name by \fIreplacement\fP.
38 .SH "OPTIONS"
39 .sp
40 \fB\-s\fP, \fB\-\-symlink\fP
41 .RS 4
42 Do not rename a symlink but its target.
43 .RE
44 .sp
45 \fB\-v\fP, \fB\-\-verbose\fP
46 .RS 4
47 Show which files were renamed, if any.
48 .RE
49 .sp
50 \fB\-n\fP, \fB\-\-no\-act\fP
51 .RS 4
52 Do not make any changes; add \fB\-\-verbose\fP to see what would be made.
53 .RE
54 .sp
55 \fB\-a\fP, \fB\-\-all\fP
56 .RS 4
57 Replace all occurrences of \fIexpression\fP rather than only the first one.
58 .RE
59 .sp
60 \fB\-l\fP, \fB\-\-last\fP
61 .RS 4
62 Replace the last occurrence of \fIexpression\fP rather than the first one.
63 .RE
64 .sp
65 \fB\-o\fP, \fB\-\-no\-overwrite\fP
66 .RS 4
67 Do not overwrite existing files. When \fB\-\-symlink\fP is active, do not overwrite symlinks pointing to existing targets.
68 .RE
69 .sp
70 \fB\-i\fP, \fB\-\-interactive\fP
71 .RS 4
72 Ask before overwriting existing files.
73 .RE
74 .sp
75 \fB\-h\fP, \fB\-\-help\fP
76 .RS 4
77 Display help text and exit.
78 .RE
79 .sp
80 \fB\-V\fP, \fB\-\-version\fP
81 .RS 4
82 Print version and exit.
83 .RE
84 .SH "WARNING"
85 .sp
86 The renaming has no safeguards by default or without any one of the options \fB\-\-no\-overwrite\fP, \fB\-\-interactive\fP or \fB\-\-no\-act\fP. If the user has permission to rewrite file names, the command will perform the action without any questions. For example, the result can be quite drastic when the command is run as root in the \fI/lib\fP directory. Always make a backup before running the command, unless you truly know what you are doing.
87 .SH "INTERACTIVE MODE"
88 .sp
89 As most standard utilities rename can be used with a terminal device (tty in short) in canonical mode, where the line is buffered by the tty and you press ENTER to validate the user input. If you put your tty in cbreak mode however, rename requires only a single key press to answer the prompt. To set cbreak mode, run for example:
90 .sp
91 .if n .RS 4
92 .nf
93 .fam C
94 sh \-c \(aqstty \-icanon min 1; "$0" "$@"; stty icanon\(aq rename \-i from to files
95 .fam
96 .fi
97 .if n .RE
98 .SH "EXIT STATUS"
99 .sp
100 \fB0\fP
101 .RS 4
102 all requested rename operations were successful
103 .RE
104 .sp
105 \fB1\fP
106 .RS 4
107 all rename operations failed
108 .RE
109 .sp
110 \fB2\fP
111 .RS 4
112 some rename operations failed
113 .RE
114 .sp
115 \fB4\fP
116 .RS 4
117 nothing was renamed
118 .RE
119 .sp
120 \fB64\fP
121 .RS 4
122 unanticipated error occurred
123 .RE
124 .SH "EXAMPLES"
125 .sp
126 Given the files \fIfoo1\fP, ..., \fIfoo9\fP, \fIfoo10\fP, ..., \fIfoo278\fP, the commands
127 .sp
128 .if n .RS 4
129 .nf
130 .fam C
131 rename foo foo00 foo?
132 rename foo foo0 foo??
133 .fam
134 .fi
135 .if n .RE
136 .sp
137 will turn them into \fIfoo001\fP, ..., \fIfoo009\fP, \fIfoo010\fP, ..., \fIfoo278\fP. And
138 .sp
139 .if n .RS 4
140 .nf
141 .fam C
142 rename .htm .html *.htm
143 .fam
144 .fi
145 .if n .RE
146 .sp
147 will fix the extension of your html files. Provide an empty string for shortening:
148 .sp
149 .if n .RS 4
150 .nf
151 .fam C
152 rename \(aq_with_long_name\(aq \(aq\(aq file_with_long_name.*
153 .fam
154 .fi
155 .if n .RE
156 .sp
157 will remove the substring in the filenames.
158 .SH "SEE ALSO"
159 .sp
160 \fBmv\fP(1)
161 .SH "REPORTING BUGS"
162 .sp
163 For bug reports, use the issue tracker at \c
164 .URL "https://github.com/util\-linux/util\-linux/issues" "" "."
165 .SH "AVAILABILITY"
166 .sp
167 The \fBrename\fP command is part of the util\-linux package which can be downloaded from \c
168 .URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."