Jump to content

(Guide/Review) Batch rename files using search and replace, regex with the SmartRename shell extension


Karlston

Recommended Posts

Batch rename files using search and replace, regex with the SmartRename shell extension

There are many ways to batch rename files, e.g. by using programs such as Rename Us or Advanced Renamer. But have you considered  using a shell extension program?

 

Batch rename files using search and replace, regex with the SmartRename shell extension for Windows

 

SmartRename is one such application, which offers some interesting options. Note that the program has been integrated into Microsoft's PowerToys collection of tools. You can install PowerToys and get access to it, or, download the standalone if you prefer that and avoid the larger footprint of PowerToys and some Telemetry that comes along with it.

 

Open Windows Explorer and right-click on a file that you want to rename, and select the "SmartRename" option from the Explorer context menu. A pop-up window should open, this is the program's interface.

 

SmartRename menu

 

It's quite simple to use. The section at the bottom of the window is the preview pane, and it displays the list of selected files with their original name and the Renamed (new name). Click the box next to a file to exclude it from the renaming process. The total number of files, and the number of files which will be renamed are displayed in the bottom left corner of the window.

 

There are two options at top of the SmartRename GUI, which are labeled "Search for" and "Replace with". Start typing in the "Search for" field, and the program will highlight the matched file in the preview pane. This works in realtime on an as-you-type basis. What it does differently is that, it removes the keyword that you typed, from the name. Type the new word you want to include in the "Replace with" field. And it will appear instead of the keyword you typed in "Search for". The rest of the name is not affected.

 

For e.g. I selected several images which contain the letters "WPD" in the name. If I were to "Search for" WPD and replace it with "Windows Privacy Dashboard", SmartRename displays the preview of the new name that contains the three words as part of the filename. Click on the rename button at the bottom of the window to apply the changes.

 

Is that all it can do? That seems pretty basic. Not quite, Smart Rename supports regular expressions.

Advanced Renaming

If you're familiar with regex metacharacters, you should be good to go. But for those who aren't, I'll describe a few examples here for basic usage.

How to add a Prefix or Suffix in SmartRename

You can add a Prefix to a name by including a caret symbol ^ in the "Search For" field. Similarly, add a Suffix by using $. You may include spaces or separators before or after the new word in the Replace with column.

 

SmartRename prefix

 

Let's look at an example. I want to add the word "Ghacks" as a prefix to the files. So I add the caret in the "Search For" field, and type "Ghacks " (there is a space after the word). SmartRename will rename the files by adding Ghacks followed by a space at the start of each file's name.

 

SmartRename suffix

Rename files completely

If you want to rename the list entirely, for e.g. a bunch of pictures with random names, use the .* search command, and type the new name in the replace field.

 

SmartRename rename all

 

SmartRename can rename files on a case sensitive basis, in which case the name is only changed for perfect matches. In our example, WPD is a match while wpd isn't. Add an incremental number to each file using the "Enumerate Files" option. Example: .$ will add a number inside parentheses at the end of every file name. (refer the 1st screenshot).

 

You can exclude files to only rename folders in the list, or exclude folders to rename files. SmartRename supports subfolders as well. Enable the "Item name only" toggle to make the application preserve the extension. Or switch the "Item extension only" to change the file extensions without editing the name.

 

SmartRename replace extension

 

While the program does not have an undo option or a history function, you may undo the changes using Windows Explorer. The caveat here is that it only works until you make another file operation in Explorer.

 

SmartRename is an open source application. It is available in 32-bit and 64-bit versions, but neither of these are portable.

 

SmartRename is a good program, but only if you use it with regex.

 

Landing Page: https://github.com/chrdavis/SmartRename

 

 

Batch rename files using search and replace, regex with the SmartRename shell extension

 

ThanksForReading200x49.jpg

Link to comment
Share on other sites


  • Views 747
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...