]> git.ipfire.org Git - thirdparty/util-linux.git/blob - misc-utils/rename.1
tests: logger with socat device
[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 [options]
10 .IR "expression replacement file" ...
11 .SH DESCRIPTION
12 .B rename
13 will rename the specified files by replacing the first occurrence of
14 .I expression
15 in their name by
16 .IR replacement .
17 .SH OPTIONS
18 .TP
19 .BR \-s , " \-\-symlink"
20 Do not rename a symlink but its target.
21 .TP
22 .BR \-v , " \-\-verbose"
23 Show which files where renamed, if any.
24 .TP
25 .BR \-V , " \-\-version"
26 Display version information and exit.
27 .TP
28 .BR \-h , " \-\-help"
29 Display help text and exit.
30 .SH EXAMPLES
31 Given the files
32 .IR foo1 ", ..., " foo9 ", " foo10 ", ..., " foo278 ,
33 the commands
34 .RS
35 .PP
36 .nf
37 rename foo foo0 foo?
38 rename foo foo0 foo??
39 .fi
40 .PP
41 .RE
42 will turn them into
43 .IR foo001 ", ..., " foo009 ", " foo010 ", ..., " foo278 .
44 And
45 .RS
46 .PP
47 .nf
48 rename .htm .html *.htm
49 .fi
50 .PP
51 .RE
52 will fix the extension of your html files.
53 .SH WARNING
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
58 know what you are doing.
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
79 .SH "SEE ALSO"
80 .BR mv (1)
81 .SH AVAILABILITY
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/.