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?
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.
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.
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.
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 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.
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.
To manipulate EXIF data and picture filenames according to EXIF data I personally use:
https://exiftool.org/gui/
Go to this page you’ll find the links to download exiftools, which is a command line utility (good for batch processing) and a (limited but quite comprehensive) GUI for this tool named ExiftoolsGUI.
Everything is explained in the page.
Both tools do NOT install but are portable, so just download the files and place them in a local folder (mine are under C:\users\username\appdata\local\programs for ex.)
To save the EXIF values in the GUI you must learn how to use, but after one or two missteps (you’ll inadvertently change from one file / field to anohter forgetting saving your changes…) you’ll get it. ;-)
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)
ANYONE KNOW OF A PROGRAM TO REPLACE THE PHOTO FILE NAME WITH THE EXIF DATE?
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
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.
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?
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.
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!
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
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.
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/
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.