Copyright (c) 2018 Nic Jansma http://nicj.net
RenameRegex (RR) is a Windows command-line bulk file renamer, using regular expressions. You can use it as a simple file renamer or with a complex regular expression for matching and replacement. See the Examples section for details.
RR.exe file-match search replace [/p] [/r] [/q|/y] [/e] [/f] [/d]
/p: pretend (show what will be renamed)
/r: recursive
/q|/y: force overwrite if the file already exists
/e: preserve file extensions
/f: include only files
/d: include only directories
default is to include files and folders
You can use .NET regular expressions for the search and replacement strings, including substitutions (for example, "$1" is the 1st capture group in the search term).
Simple rename without a regular expression:
RR.exe * .ext1 .ext2
Renaming with a replacement of all "-" characters to "_":
RR.exe * "-" "_"
Remove all numbers from the file names:
RR.exe * "[0-9]+" ""
Rename files in the pattern of "124_xyz.txt
" to "xyz_123.txt
":
RR.exe *.txt "([0-9]+)_([a-z]+)" "$2_$1"
- v1.0 - 2012-01-30: Initial release
- v1.1 - 2012-12-15: Added /r option
- v1.2 - 2013-05-11: Allow /p and /r options before or after main arguments
- v1.3 - 2013-10-23: Added /f option
- v1.4 - 2018-04-06: Added /e option via Marcel Peeters
- v1.5 - 2020-07-02: Added support for directories, added length-check, and reformatted log
- Nic Jansma (http://nicj.net)
- Marcel Peeters