2018-04-05 08:48:14 +01:00
|
|
|
# repren
|
|
|
|
|
|
|
|
> Multi-pattern string replacement and file renaming tool.
|
2019-06-03 02:06:36 +02:00
|
|
|
> More information: <https://github.com/jlevy/repren>.
|
2018-04-05 08:48:14 +01:00
|
|
|
|
2021-08-15 19:59:09 +02:00
|
|
|
- Do a dry-run renaming a directory of PNGs with a literal string replacement:
|
2018-04-05 08:48:14 +01:00
|
|
|
|
2025-07-23 19:08:45 +03:00
|
|
|
`repren {{[-n|--dry-run]}} --rename --literal --from '{{find_string}}' --to '{{replacement_string}}' {{*.png}}`
|
2018-04-05 08:48:14 +01:00
|
|
|
|
2025-07-25 08:50:06 +03:00
|
|
|
- Do a dry-run renaming a directory of JPEGs with a `regex`:
|
2018-04-05 08:48:14 +01:00
|
|
|
|
2025-07-25 08:50:06 +03:00
|
|
|
`repren --rename {{[-n|--dry-run]}} --from '{{regex}}' --to '{{replacement_string}}' {{*.jpg}} {{*.jpeg}}`
|
2018-04-05 08:48:14 +01:00
|
|
|
|
2021-08-15 19:59:09 +02:00
|
|
|
- Do a find-and-replace on the contents of a directory of CSV files:
|
2018-04-05 08:48:14 +01:00
|
|
|
|
|
|
|
`repren --from '{{([0-9]+) example_string}}' --to '{{replacement_string \1}}' {{*.csv}}`
|
|
|
|
|
|
|
|
- Do both a find-and-replace and a rename operation at the same time, using a pattern file:
|
|
|
|
|
2025-07-23 19:08:45 +03:00
|
|
|
`repren {{[-p|--patterns]}} {{path/to/patfile.ext}} --full {{*.txt}}`
|
2018-04-05 08:48:14 +01:00
|
|
|
|
|
|
|
- Do a case-insensitive rename:
|
|
|
|
|
2025-07-23 19:08:45 +03:00
|
|
|
`repren --rename {{[-i|--insensitive]}} {{[-p|--patterns]}} {{path/to/patfile.ext}} *`
|