Skip to content

Synetech/rename-regex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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] [/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).

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
  • v1.5 - 2020-07-02: Added support for directories, added length-check, and reformatted log

Credits

About

Windows command-line regex file renamer

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%