65.9K
CodeProject is changing. Read more.
Home

Mass Renamer

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.47/5 (6 votes)

May 25, 2007

CPOL

1 min read

viewsIcon

29306

downloadIcon

360

A quick example of how to batch-

Screenshot - RenamerRun.png

Introduction

This code will recurse all files in a given folder and rename them based on the rules you fill out on the UI form. I wrote it because I was tired of people trying to get me to pay for a utility that did the same thing. It occurs to me that others may like to look at it or just use it. Either way, I need to give something back. This project is a complete working utility, although you could extend it and shore it up some.

Using the code

Using the code should be extremely easy, especially since it's scoped internal static. You don't even need to instantiate the core object. Simply begin to assign the properties of the object to set behaviors:

//
//  FileRecurser.REPLACE_TEXT_1_FLAG = true;
//  FileRecurser.FIND_TEXT_1         = txtFindText.Text;
//  FileRecurser.REPLACE_TEXT_1      = txtReplaceText.Text;         
//            

Once you have everything set, simply fire up the only method: RenameFiles.

//  
//  fire it up
//  FileRecurser.ReNameFiles(txtFOLDER.Text);
//

Points of interest

This is a very simple project. It's the kind of thing you say you are going to do everyday, but then never get around to it. It was inspired and written in a few hours; I have no doubt that it will be of use to someone out there. Keep posting!

History

  • 25 May, 2007 - This is version 1.0: Buyer beware! Use at your own Risk!!