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