F2 Batch File Renamer

Click to see F2 screenshot

F2 is a Windows program that provides an automated way of renaming batches of files. I wrote it after needing something to rename thousands of mp3 files - I tried about 5 or 6 different renaming programs, but they all seemed to be designed to do a different task than the one I wanted to do.

If you want to know why it is called F2, select a file in Windows Explorer, and then press the F2 key.

How to Use

Coming soon... :-)

Regular Expressions

In order to support regular expressions, F2 uses the open source C++ library boost regex++, which is part of the boost library. If you want to know about the regular expression syntax accepted by regex++ (and hence by F2) then read this web page from the regex++ documentation. The syntax is pretty 'standard', however, as a brief summary:
  • Character classes work as you would expect, e.g.
      [a-zA-Z0-9]
  • Tagged expressions should be contained in parentheses, e.g.
      (Match1.*) (Match2.*)
    This would allow you to use %1 and %2 in your renaming scheme, and they would be replaced with the matched part of the filename.
  • Don't forget to escape 'special' characters with a backslash, e.g.
      \(This is in brackets, and is not a tagged expression\)

So, say for example, you have a collection of mp3 files that are named using the following general pattern:

    Artist - Album - TrackNumber - Trackname.mp3

so, for example, you might have:

  • Erasure - Wild - 01 - Piano Song (Instrumental).mp3
  • Erasure - Wild - 02 - Blue Savannah.mp3
  • Erasure - Wild - 03 - Drama!.mp3
  • Erasure - Wild - 04 - How Many Times.mp3
  • Erasure - Wild - 05 - Star.mp3

...and so on, and you want to rename the files so that you have a folder for each artist, and a sub-folder within that for each album, and in that album folder are the mp3 files of the tracks from that album. But you only want the mp3 files to be named using the track number and name.

In this case, you would use the following regular expression to match each of the filename components:

    (.*) - (.*) - (.*) - (.*).mp3

This would get you 4 tagged expressions (%1 through %4), which you can then use to rename the file. In our example, we would use this as the new filename pattern:

    %1\%2\%3.%4.mp3

If you used F2 to rename using this scheme, our example files would end up in a nested folder hierarchy, as follows:

  • Erasure
    • Wild
      • 01.Piano Song (Instrumental).mp3
      • 02.Blue Savannah.mp3
      • 03.Drama!.mp3
      • 04.How Many Times.mp3
      • 05.Star.mp3

Issues

The program has a few rough edges which I'll try to fix soon. In particular, at the moment the checkbox for enabling mp3 tags has no effect (the tags are always read and used if you use any mp3tag keywords in your renaming scheme).

It should run on Windows 95 upwards, but so far I have only tested it on Windows 2000 and Windows XP.

Download

Platforms: Windows

License: GPL

Copyright: Tim Browse, 2002

Status: Completeness: 8/10, Reliability: 7/10

Version History

Version 1.01

  • Fixed endless loop bug when no files are found in a folder, or the filter matches zero files. (Bad programmer! Back in your box!)

Version 1.00

The original version.

Acknowledgements

Many thanks to:
  • Yoz Grahame for various cool ideas about how to make F2 cool and super powerful, most of which I have yet to implement. But I'll try.
  • Sean Sollé for endless nagging about improving the UI, and making absolutely everything update in the background, thus simplifying the UI and removing many buttons from the dialog. As Jason Williams once said, "It's a lot easier to know which button to press when there's only one button."
  • John Maddock for the regex++ library, which saved me a ton of work, and has so far worked flawlessly (although I would like to bend his ear sometime about copy constructors that throw exceptions... hhhnnnnggg!)
  • Dirk Mahoney and the other developers at id3lib.sourceforge.net for the id3lib code, which F2 uses to read ID3 tags from mp3 files. They also saved me a ton of work and allowed me to add a nice feature to F2.