Windows command-line regex file renamer
C#
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
source
.gitignore
LICENSE
README.md

README.md

Copyright (c) 2018 Nic Jansma http://nicj.net

Introduction

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.

Usage

RR.exe file-match search replace [/p] [/r] [/f] [/e]
 /p: pretend (show what will be renamed)
 /r: recursive
 /f: force overwrite if the file already exists
 /e: preserve file extensions

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).

Examples

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"

Version History

  • 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

Credits