]>
Commit | Line | Data |
---|---|---|
eb63b9b8 KZ |
1 | .\" Written by Andries E. Brouwer (aeb@cwi.nl) |
2 | .\" Placed in the public domain | |
3 | .\" | |
232dc924 | 4 | .TH RENAME 1 "June 2011" "util-linux" "User Commands" |
eb63b9b8 | 5 | .SH NAME |
0791a058 | 6 | rename \- rename files |
eb63b9b8 | 7 | .SH SYNOPSIS |
f736d385 | 8 | .B rename |
f49ccec2 BS |
9 | [options] |
10 | .IR "expression replacement file" ... | |
eb63b9b8 KZ |
11 | .SH DESCRIPTION |
12 | .B rename | |
13 | will rename the specified files by replacing the first occurrence of | |
03b3d715 | 14 | .I expression |
eb63b9b8 | 15 | in their name by |
03b3d715 SK |
16 | .IR replacement . |
17 | .SH OPTIONS | |
2a45745f | 18 | .TP |
03b3d715 SK |
19 | \fB\-v\fR, \fB\-\-verbose\fR |
20 | Give visual feedback which files where renamed, if any. | |
21 | .TP | |
22 | \fB\-V\fR, \fB\-\-version\fR | |
2a45745f | 23 | Display version information and exit. |
03b3d715 | 24 | .TP |
5a2a8177 JM |
25 | \fB\-s\fR, \fB\-\-symlink\fR |
26 | Peform rename on symlink target | |
27 | .TP | |
03b3d715 | 28 | \fB\-h\fR, \fB\-\-help\fR |
449a215f | 29 | Display help text and exit. |
0791a058 BS |
30 | .SH EXAMPLES |
31 | Given the files | |
eb63b9b8 KZ |
32 | .IR foo1 ", ..., " foo9 ", " foo10 ", ..., " foo278 , |
33 | the commands | |
eb63b9b8 | 34 | .RS |
03b3d715 | 35 | .PP |
eb63b9b8 KZ |
36 | .nf |
37 | rename foo foo0 foo? | |
38 | rename foo foo0 foo?? | |
39 | .fi | |
03b3d715 | 40 | .PP |
eb63b9b8 | 41 | .RE |
eb63b9b8 KZ |
42 | will turn them into |
43 | .IR foo001 ", ..., " foo009 ", " foo010 ", ..., " foo278 . | |
eb63b9b8 KZ |
44 | And |
45 | .RS | |
03b3d715 | 46 | .PP |
eb63b9b8 KZ |
47 | .nf |
48 | rename .htm .html *.htm | |
49 | .fi | |
03b3d715 | 50 | .PP |
eb63b9b8 | 51 | .RE |
eb63b9b8 | 52 | will fix the extension of your html files. |
03b3d715 | 53 | .SH WARNING |
449a215f BS |
54 | The renaming has no safeguards. If the user has permission to rewrite file names, |
55 | the command will perform the action without any questions. For example, the | |
56 | result can be quite drastic when the command is run as root in the /lib | |
57 | directory. Always make a backup before running the command, unless you truly | |
03b3d715 | 58 | know what you are doing. |
d6cf9e16 SK |
59 | .SH "EXIT STATUS" |
60 | .RS | |
61 | .PD 0 | |
62 | .TP | |
63 | .B 0 | |
64 | all requested rename operations were successful | |
65 | .TP | |
66 | .B 1 | |
67 | all rename operations failed | |
68 | .TP | |
69 | .B 2 | |
70 | some rename operations failed | |
71 | .TP | |
72 | .B 4 | |
73 | nothing was renamed | |
74 | .TP | |
75 | .B 64 | |
76 | unanticipated error occurred | |
77 | .PD | |
78 | .RE | |
eb63b9b8 KZ |
79 | .SH "SEE ALSO" |
80 | .BR mv (1) | |
86d62711 | 81 | .SH AVAILABILITY |
601d12fb KZ |
82 | The rename command is part of the util-linux package and is available from |
83 | ftp://ftp.kernel.org/pub/linux/utils/util-linux/. |