File tree Expand file tree Collapse file tree 4 files changed +81
-2
lines changed Expand file tree Collapse file tree 4 files changed +81
-2
lines changed Original file line number Diff line number Diff line change 1+ # rename
2+
3+ > Rename multiple files.
4+ > NOTE: this page refers to the command from the ` file-rename ` Debian package.
5+
6+ - Rename files using a Perl Common Regular Expression (substitute 'foo' with 'bar' wherever found):
7+
8+ ` rename {{'s/foo/bar/'}} {{*}} `
9+
10+ - Dry-run - display which renames would occur without performing them:
11+
12+ ` rename -n {{'s/foo/bar/'}} {{*}} `
13+
14+ - Force renaming even if the operation would remove existing destination files:
15+
16+ ` rename -f {{'s/foo/bar/'}} {{*}} `
17+
18+ - Convert filenames to lower case (use ` -f ` in case-insensitive filesystems to prevent "already exists" errors):
19+
20+ ` rename 'y/A-Z/a-z/' {{*}} `
21+
22+ - Replace whitespace with underscores:
23+
24+ ` rename 's/\s+/_/g' {{*}} `
Original file line number Diff line number Diff line change 1+ # rename
2+
3+ > Rename multiple files.
4+ > NOTE: this page refers to the command from the ` perl-rename ` Arch Linux package.
5+
6+ - Rename files using a Perl Common Regular Expression (substitute 'foo' with 'bar' wherever found):
7+
8+ ` rename {{'s/foo/bar/'}} {{*}} `
9+
10+ - Dry-run - display which renames would occur without performing them:
11+
12+ ` rename -n {{'s/foo/bar/'}} {{*}} `
13+
14+ - Force renaming even if the operation would remove existing destination files:
15+
16+ ` rename -f {{'s/foo/bar/'}} {{*}} `
17+
18+ - Convert filenames to lower case (use ` -f ` in case-insensitive filesystems to prevent "already exists" errors):
19+
20+ ` rename 'y/A-Z/a-z/' {{*}} `
21+
22+ - Replace whitespace with underscores:
23+
24+ ` rename 's/\s+/_/g' {{*}} `
Original file line number Diff line number Diff line change 11# rename
22
3- > Renames multiple files.
3+ > Rename multiple files.
4+ > NOTE: this page refers to the command from the ` prename ` Fedora package.
45
56- Rename files using a Perl Common Regular Expression (substitute 'foo' with 'bar' wherever found):
67
1011
1112` rename -n {{'s/foo/bar/'}} {{*}} `
1213
13- - Force renaming even if the operation would overwrite existing files:
14+ - Force renaming even if the operation would remove existing destination files:
1415
1516` rename -f {{'s/foo/bar/'}} {{*}} `
1617
Original file line number Diff line number Diff line change 1+ # rename
2+
3+ > Rename multiple files.
4+ > NOTE: this page refers to the command from the ` util-linux ` package.
5+ > For the Perl version, see ` file-rename ` or ` perl-rename ` .
6+ > Warning: This command has no safeguards and will overwrite files without prompting.
7+
8+ - Rename files using simple substitutions (substitute 'foo' with 'bar' wherever found):
9+
10+ ` rename {{foo}} {{bar}} {{*}} `
11+
12+ - Dry-run - display which renames would occur without performing them:
13+
14+ ` rename -vn {{foo}} {{bar}} {{*}} `
15+
16+ - Do not overwrite existing files:
17+
18+ ` rename -o {{foo}} {{bar}} {{*}} `
19+
20+ - Change file extensions:
21+
22+ ` rename {{.ext}} {{.bak}} {{*.ext}} `
23+
24+ - Prepend "foo" to all filenames in the current directory:
25+
26+ ` rename {{''}} {{'foo'}} {{*}} `
27+
28+ - Rename a group of increasingly numbered files zero-padding the numbers up to 3 digits:
29+
30+ ` rename {{foo}} {{foo00}} {{foo?}} && rename {{foo}} {{foo0}} {{foo??}} `
You can’t perform that action at this time.
0 commit comments