tldr/pages/common/rename.md

20 lines
415 B
Markdown
Raw Normal View History

2014-02-23 17:08:04 +00:00
# rename
> Renames multiple files.
2014-02-23 17:08:04 +00:00
- Rename files using a Perl Common Regular Expression (substitute 'foo' with 'bar' wherever found):
2014-02-23 17:08:04 +00:00
`rename {{'s/foo/bar/'}} {{\*}}`
2014-02-23 17:08:04 +00:00
2016-01-20 17:59:42 +00:00
- Dry-run - display which renames would occur without performing them:
2014-02-23 17:08:04 +00:00
`rename -n {{'s/foo/bar/'}} {{\*}}`
2014-02-23 17:08:04 +00:00
- Convert filenames to lower case:
2014-02-23 17:08:04 +00:00
`rename 'y/A-Z/a-z/' {{\*}}`
- Replace whitespace with underscores:
`rename 's/\s+/_/g' {{\*}}`