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