mirror of
https://github.com/tldr-pages/tldr.git
synced 2024-11-14 10:32:11 +03:00
89c43ca8e4
Address the presence of multiple and different versions of the rename command as discussed in issue #3125. Changes made: - Moved common/rename.md to linux/prename.md, documenting the Debian Perl rename command (which is deprecated). - Created linux/file-rename.md for the Debian/Ubuntu `file-rename`. - Created linux/perl-rename.md with examples for Arch Linux `perl-rename`. - Created linux/rename.md for the `rename` command offered by the the `util-linux` package, the most common one and supported by the most platforms.
874 B
874 B
rename
Rename multiple files. NOTE: this page refers to the command from the
util-linux
package. For the Perl version, seefile-rename
orperl-rename
. Warning: This command has no safeguards and will overwrite files without prompting.
- Rename files using simple substitutions (substitute 'foo' with 'bar' wherever found):
rename {{foo}} {{bar}} {{*}}
- Dry-run - display which renames would occur without performing them:
rename -vn {{foo}} {{bar}} {{*}}
- Do not overwrite existing files:
rename -o {{foo}} {{bar}} {{*}}
- Change file extensions:
rename {{.ext}} {{.bak}} {{*.ext}}
- Prepend "foo" to all filenames in the current directory:
rename {{''}} {{'foo'}} {{*}}
- Rename a group of increasingly numbered files zero-padding the numbers up to 3 digits:
rename {{foo}} {{foo00}} {{foo?}} && rename {{foo}} {{foo0}} {{foo??}}