Skip to content
Lloyd Brookes edited this page Jul 17, 2018 · 6 revisions

You can view these docs at any time by running renamer --help.


renamer

  Rename files in bulk. 

Synopsis

  $ renamer [options] [file ...] 

Replace chain

  ↓ Default   Find and replace strings and regular expressions.                                                      
  ↓ Index     Replace the `{{index}}` token in a path with a number incremented for each file renamed.

General options

  -d, --dry-run         Set this to do everything but rename the file. You should always set this
                        flag until certain the output looks correct.
  --force               If a target path exists, renamer will stop. With this flag set the target
                        path will be overwritten. The main use-case for this flag is to enable
                        changing the case of files on case-insensitive systems. Use with caution.
  --view long|diff      The default view outputs one line per rename. Set `--view long` to see a
                        longer, less condensed view and `--view diff` to include a diff.
  -p, --plugin string   One or more replacer plugins to use, set the `--plugin` option multiple times
                        to build a chain. For each value, supply either: a) a path to a plugin file
                        b) a path to a plugin package c) the name of a plugin package installed
                        globally or in the current working directory (or above) or d) the name of a
                        built-in plugin, either `default` or `index`. The default plugin chain is
                        `default` then `index`, be sure to set `-p default -p index` before your
                        plugin if you wish to extend default behaviour.
  -v, --verbose         In the output, also include names of files that were not renamed.
  -h, --help            Print usage instructions.

Plugin: Default

  -f, --find string      Optional find string (e.g. `one`) or regular expression literal (e.g.
                         `/one/i`). If omitted, the whole filename will be matched and replaced.
  -r, --replace string   The replace string. If omitted, defaults to an empty string.
  -e, --path-element     The path element to rename, valid values are `base` (the default), `name` and
                         `ext`. For example, in the path `pics/image.jpg`, the base is `image.jpg`,
                         the name is `image` and the ext is `.jpg`.

Plugin: Index

  --index-format    The format of the number to replace `{{index}}` with. Specify a standard
                    printf format string, for example `%03d` would yield 001, 002, 003 etc.
                    Defaults to `%d`.

  For detailed instructions, visit https://github.com/75lb/renamer

Clone this wiki locally