1RENAME(1)                        User Commands                       RENAME(1)
2
3
4

NAME

6       rename - rename files
7

SYNOPSIS

9       rename [options] expression replacement file...
10

DESCRIPTION

12       rename  will  rename  the specified files by replacing the first occur‐
13       rence of expression in their name by replacement.
14

OPTIONS

16       -s, --symlink
17              Do not rename a symlink but its target.
18
19       -v, --verbose
20              Show which files were renamed, if any.
21
22       -n, --no-act
23              Do not make any changes.
24
25       -o, --no-overwrite
26              Do not overwrite existing files.  When --symlink is  active,  do
27              not overwrite symlinks pointing to existing targets.
28
29       -V, --version
30              Display version information and exit.
31
32       -h, --help
33              Display help text and exit.
34

EXAMPLES

36       Given the files foo1, ..., foo9, foo10, ..., foo278, the commands
37
38              rename foo foo00 foo?
39              rename foo foo0 foo??
40
41       will turn them into foo001, ..., foo009, foo010, ..., foo278.  And
42
43              rename .htm .html *.htm
44
45       will fix the extension of your html files.  Provide an empty string for
46       shortening:
47
48              rename '_with_long_name' '' file_with_long_name.*
49
50       will remove the substring in the filenames.
51

WARNING

53       The renaming has no safeguards except the --no-act option.  If the user
54       has  permission  to  rewrite  file  names, the command will perform the
55       action without any questions.  For example, the  result  can  be  quite
56       drastic  when the command is run as root in the /lib directory.  Always
57       make a backup before running the command, unless you  truly  know  what
58       you are doing.
59

EXIT STATUS

61              0      all requested rename operations were successful
62              1      all rename operations failed
63              2      some rename operations failed
64              4      nothing was renamed
65              64     unanticipated error occurred
66

SEE ALSO

68       mv(1)
69

AVAILABILITY

71       The  rename  command is part of the util-linux package and is available
72       from https://www.kernel.org/pub/linux/utils/util-linux/.
73
74
75
76util-linux                         June 2011                         RENAME(1)
Impressum