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

ADVERTISEMENT

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.

Summary
software image
Author Rating
1star1star1stargraygray
1 based on 1 votes
Software Name
SmartRename
Operating System
Windows
Software Category
Productivity
Price
Free
Landing Page
Advertisement

Previous Post: «
Next Post: »

Comments

  1. Paul(us) said on June 7, 2020 at 12:28 pm
    Reply

    It’s too bad that you only renamed a few (Less than 10) files this because I could not see or this program is better than most rename programs who have problems when you go over 10 files at once.
    Normally they fall short because let’s say picture with the names 1,2 3 4,5, etc are not recognized as such. 2 is not renamed to 02 or even 002. So 2 is then in the line placed from 20 and 30.
    The big problem comes when you have more than 100 numbers.
    Then you have to rename everything under one hundred. So you have to rename 2 to 002.
    I hear you thinking to make the name start with a 0 but then 12 becomes 012 and is put before 1, 2, 3, etc etc.

    Maybe I am missing this possibility in the settings but I can’t find in the programs that I have tried being advanced renamer (version 3.85) and better renamer (version 6.19)?
    Anybody?

    1. Kincaid said on June 7, 2020 at 1:07 pm
      Reply

      Paul(us), I am challenged to understand your English, but if I understand you correctly, I think the multi-rename functionality in FreeCommander XE will do exactly what you want.

      FreeCommander XE is available here: https://freecommander.com/

      1. Paul(us) said on June 8, 2020 at 1:15 pm
        Reply

        Thanks, Kincaid, I thought I already tried Freecommander some years ago but I will try it again.
        Maybe the latest version has onboard what I need.

    2. Pants said on June 7, 2020 at 7:22 pm
      Reply

      Paul(us) – I’ve been using ReNamer ( https://www.den4b.com/ ) for 8 or 9 years. I’m using v5.71 (from 2013) which is the last non-crippled free version (portable). It’s very powerful: you can create presets, and add as many rules as you like (insert, delete, remove, replace, rearrange, strip, case, serialize, regex, scripts, modify the extension, and more: and each of those options for a new rule can have options: like replace first or replace all etc) and for each preset you can define the extensions: then just drag and drop items/folders into it for a preview

      You could download and try the portable version to see if it does what you need ( https://www.den4b.com/downloads/renamer : note that 5.71 is no longer available) – I have no idea of the cost to purchase or what limitations there are in the demo

      1. Paul(us) said on June 8, 2020 at 1:20 pm
        Reply

        Thanks, Pants for the effort of answering my question. I will research the possibility functions wise who ReNamer will offer me. Maybe the https://archive.org/web/web.php or any other alike website will have a version 5.71 release available. I will go look for that. When I can’t find this particular version I will try a later version.

    3. X said on June 7, 2020 at 7:33 pm
      Reply

      D/L FileMenu Tools from https://www.lopesoft.com/index.php/en/download/filemenu-tools.

      FileMenu Tools lets you add both custom commands and some build-in utilities in order to do operations over both files and folders from the Windows Explorer

      In the Advanced Renamer utility there is an option to Add Sequence to a name. Just enter 000 to add 000, 001, 002, etc. You may insert variables in the file name or use regular expressions.

      It allows you to modify/rename extensions and to store/recall renaming profiles.

      Moreover, LopeSoft offers a portable version.

      The free version is limited to renaming 20 files max. At €9.99 EUR, the full version is a steal.

      Full disclosure: I’m not affiliated in any way with LopeSoft. It’s just that the software made my top 10 list.

      1. Paul(us) said on June 8, 2020 at 1:25 pm
        Reply

        Thanks, X for attending me to a program I never heard off.
        I will certainly try this and after I glanced at there website I was quite optimistic that this could be the piece of software I was looking for. So I am going to give it the good old college try!

  2. Anonymous said on June 8, 2020 at 4:22 pm
    Reply

    Paul(us) – Bulk Rename Utility (BRU) is capable of doing what you want with numbering sequences. And many other things as well. The regex is extremely versatile. The program is free for individual use with the only limitation I’ve found is the javascript renaming functions.
    Full installer or portable options available.
    https://www.bulkrenameutility.co.uk/Download.php

    1. Paul(us) said on June 9, 2020 at 9:20 pm
      Reply

      Thanks, Anonymous, This looks really great. I am going to study and (Despite the Javascript renaming functions) implement it directly.

      Nice to see that it also offers a 64 bit and portable version.
      I have already worked back in 2011-03-20 with Bulk Rename Utility, 2.7.1.2.
      But I totally forgot this specific product last year when I again needed this kind of specific function in a renaming tool. Hopefully, this 3.3.2.0 will do the trick.

  3. PANAMA PATRICK said on June 15, 2020 at 1:59 am
    Reply

    ANYONE KNOW OF A PROGRAM TO REPLACE THE PHOTO FILE NAME WITH THE EXIF DATE?

  4. empirefall said on August 12, 2020 at 12:33 am
    Reply

    I deal with ‘a lot’ of files of different formats related to the same subject which come from multiple sources, as a means to keep the titles of those files better organized, I use a program called ‘ReNamer Pro’ (which I don’t think has been covered on ghacks before, after doing a little search of previous articles), it essentially does what the above mentioned program does, the main difference being that the program I use provides a more complex set of parameters, that can be good, on one hand, because it offers the user a wider range of configurations so that they can make precise changes to a selection of different files, but it can also be bad if the user doesn’t have an understanding of what they are doing (there is an undo button for that), the program also offers a preview column to show what the selected parameters will result in if executed (requires the implementation of good logic skills)

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.