Return to Digital Photography Articles
Bulk / Batch File Renaming Utilities
Many people have a real mess of files on their hard drives, thanks to thousands of digital photos and MP3s that get copied without any thought to organization. Thankfully, some very useful batch renaming utilities can help rescue your collection in a matter of seconds!
Why Rename Files?
In the ideal world, you would organize your files as soon as you create them... but clearly this doesn't always happen. We get lazy... Soon enough, you end up with folders full of arbitrarily or inconsistently-named files.
|Typical mess of disorganized filenames|
The Best way to Rename Files
The best method is to rename during the copy of files to your hard drive. The reason I recommend this approach is two-fold:
- Renaming should be done as early as possible
- Automating the renaming removes the lazy human element
For most photographers, this means performing the organizing step during the importing of images from the memory card.
There are several standalone photo importing programs (and photo catalog programs) that do a great job at this. One utility that I often recommend is DownloaderPro. The creation of the folder hierarchy and file naming scheme is handled automatically.
Why Rename Now?
Unfortunately, the longer that your files are disorganized, the more likely it is that some program will have recorded the bad folder and file name choices. For example, a photo catalog associates each image file on your hard drive with an entry in a database (containing keywords, tags, etc.) If you decide later to rename the folders or files, the link will be broken, and you may have a hard time instructing the software to relocate all of the renamed / moved files.
|Typical relocation error after renaming|
Things get even worse if you have implemented a backup scheme. Most backup utilities only store / archive the files that have changed since the last backup. Unfortunately, changing a file's path or filename breaks the link in the backup database and the software naturally treats all of these files as having changed (new). If you change a large number of filenames / folder names in your photo collection, your incremental backup could end up being very unwieldy. You should always attempt to get your folders and files organized before you start an automated backup scheme.
Comparison of Batch Renaming Utilities
The following table lists a few of the more useful standalone renaming utilities (for Windows) that I have come across. All of these utilities are free or request a donation. If you know of another free Windows utility that is comparable to these, please leave a comment below.
|Utility||Ease of Use||Price||RegEx||Metadata||Preview||Undo||Context|
|Flexible Renamer||Easy||Free||Yes||File, EXIF, IPTC, ID3, ...||Live||Yes||Yes (SendTo)|
|THE Rename||Med||Donate||Yes||File, EXIF, IPTC, ID3, ...||Invoked||Yes||Yes (Folder Only)|
|Bulk Renaming Utility||Med||Donate||Yes||File, (EXIF.DateTime)||Live||Yes||Yes|
For a description of the various fields listed above, please see the section on Features in Renaming Software below.
Features of Renaming Software
It can be a daunting task trying to compare different renaming utilities as there is such a wide range of features that each may provide. However, it is important to narrow down the feature list into the elements that are most useful. The following list describes a number of key features that one should consider evaluating when looking at renaming utilities:
- Regex Capability - All renaming programs offer some degree of search and replace. How well this feature is implemented is the most important factor to consider. The most basic implementation is the straight-forward Search & Replace. More advanced programs offer Search String Wildcards. The best programs offer Regular Expressions with Pattern Substitution.
- Replacement Tokens / Metadata - Tokens are items that you can insert in the new filename which represent a special value, such as the current date, EXIF field, etc. One of the more useful tokens represents the EXIF field DateTimeOriginal which is the date that you took a photo (not the date the file was created on your hard drive). If EXIF makernotes are supported, it may even be possible to retrieve other unique sequencing, such as the shot counters.
- Sequence Numbering - Sometimes, there is not enough unique information in the original filename and then it becomes necessary to have the renaming application generate an incrementing sequence number. Configuration options usually specify how many digits are created and whether or not leading zeros are used.
- Filename Collisions - When renaming files, it is often the case that one or more of the new filenames will be identical. As duplicate filenames are never a good idea, the utility must provide some way of resolving these conflicts. Some programs simply present the user with an error, while others provide more intelligent ways to handle the name collision and continue on.
- Live Preview - A preview feature is an absolute necessity: it means that the program will show you how the selected filenames should look after the rename operation, but before it is done. A live preview changes automatically as you change your options and is invaluable in creating more complex renaming operations, particularly in the case of Regular Expression matching.
- Undo - When renaming a large number of files at once, there will be times when the user will recognize that a mistake has been made (especially if the live preview was ignored). Being able to undo the last renaming operation is very important, as often it will be impossible to deduce the original filenames.
- Folder Recursion - Recursion is the ability to perform the renaming operation not only on the files within the currently selected folder, but also on files / folders inside the current folder. When dealing with large renaming operations (such as across your entire photo collection), recursion is a must.
- Context Menu - Some programs offer the ability to launch the application from right-clicking on a group of files, rather than having to open up the application first. Context menu support can be a big timesaver if you often find yourself renaming files.
- Supported - Working with a program that is well-supported and has recent development by the author can save you time if you happen to run into difficulties. Thankfully, most renaming programs are fairly straightforward and a utility written several years ago may still continue to perform the job just fine today.
Regular Expression - RegEx - The best feature of all!
One problem with most renaming utilities is that they try to add a renaming feature for every possible scenario that they felt might be useful. Unfortunately, there is no shortage of unique file naming requirements and weird combinations of original filenames, and so we end up with renaming that have extremely cluttered user interfaces.
The best solution is something called a Regular Expression or RegEx. RegEx is well-known to most computer programmers, but is not often familiar to the average computer user. The power in regular expressions lies in the ability to perform grouping or backreferences. Essentially, this means that you can rearrange parts of the original filename to make the new filename. Search and replace generally cannot do this.
The following table shows a few examples of what one can do with regular expressions. Note that regex commands will differ depending on the program and tokens provided (for example: assume that the token "\Y" is replaced by the 4-digit current year). In the following, the regex command is also assumed to be specified in the format /search/replacement/. In each case, I am trying to target my desired file naming scheme:
|Original Filename||New Filename||RegEx Command|
|Copy of 20070522_1234.jpg||20070522_1234.jpg||/Copy of //|
|20070522_1234 edited.jpg||20070522_1234-e.jpg||/ edited/-e/|
|Jungle 1234 pix.jpg||20070522_1234.jpg||/Jungle (.*) pix/\Y\M\D_\1/|
|Img 123 - 20070522.jpg||20070522_0123.jpg||/Img (.*) - (.*).jpg/\2_0\1/|
Another great use for regex renaming is in modifying the numbering scheme that may already be used in your filenames. For example, let's say you have a list of files that were numbered without leading zeros. Numbering in file names should always use a leading zeros notation so that you don't end up with variable-length filenames. For example:
|Original Filename||New Filename||RegEx Command|
As one can see in the above examples, there is virtually no limit to the types of renaming that one can do on files with regular expressions. Note that only the first three examples could be achieved with a standard search & replace function. The last two examples demonstrate substring matching / replacement (also known as grouping and backreferences), which allows one to rearrange parts of the original filename in any order (using substring tokens \1 and \2).
More information about RegEx and how to use it:
- Regular Expressions Library
- Regular Expression Tutorials and Quick Start
- Regular Expressions by Grymoire
- Regular Expression Background