1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/rename.md
Waldir Pimenta 54a666316e rename.md: add -f flag (#960)
* rename.md: add note about -f flag

* rename.md: add -f example
2016-07-20 07:47:32 +02:00

23 lines
602 B
Markdown

# rename
> Renames multiple files.
- Rename files using a Perl Common Regular Expression (substitute 'foo' with 'bar' wherever found):
`rename {{'s/foo/bar/'}} {{\*}}`
- Dry-run - display which renames would occur without performing them:
`rename -n {{'s/foo/bar/'}} {{\*}}`
- Force renaming even if the operation would overwrite existing files:
`rename -f {{'s/foo/bar/'}} {{\*}}`
- Convert filenames to lower case (use `-f` in case-insensitive filesystems to prevent "already exists" errors):
`rename 'y/A-Z/a-z/' {{\*}}`
- Replace whitespace with underscores:
`rename 's/\s+/_/g' {{\*}}`