Skip to content
Lloyd Brookes edited this page May 1, 2021 · 6 revisions

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


renamer

  Rename files in bulk.

Synopsis

  $ renamer [options] [file ...]

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 string          Use one of the built-in views ("long", "diff", "one-line") or supply a path
                         to a custom view. 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. Use `--view one-line` to output the summary line only.
  -c, --chain string[]   One or more replace chain plugins to use, set the `--chain` option multiple
                         times to build a chain. For each value, supply either: a) a path to a plugin
                         file b) a path to an installed plugin package or c) the name of a built-in
                         plugin, either `find-replace` or `index-replace`. The default plugin chain is
                         `find-replace` then `index-replace`.
  -s, --silent           Silent mode.
  -v, --verbose          In the output, also include names of files that were not renamed.
  -h, --help             Print usage instructions.

Replace chain

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

Plugin: FindReplace

  -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 string   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: IndexReplace

  --index-format string   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`.
  --index-root string     The initial value for `{{index}}`. Defaults to 1.

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