ren
is a command-line utility that takes find
-formatted lines via standard input, and batch renames them. By default, it outputs a diff
-preview of the renamed files and directories to standard output, and with a flag it can rename the files and directories.
Output a diff to standard output showing the result of finding all the files containing foo
in their name, and replacing foo
to bar
in their names:
find . -name '*foo*' | ren foo bar
Add the -w
(--write
) flag to rename the files:
find . -name '*foo*' | ren foo bar
ren
is available via cargo
:
cargo install ren-find
The default pager is less
, the REN_PAGER
environment variable can be used to override the pager (e.g., export REN_PAGER=delta
in Bash).
ren -h
(or ren --help
, the full --help
provides slightly longer explanations of some option) will list help for all the command-line flags.