Padding numerical value in Title or Filename

So far I've been able to accomplish many changes with MP3Tag, what a great tool! But the last thing I'm having difficulty with is the track # in either the title or filename.

When the CD's were ripped, the track field was padded with a preceeding "0" like this; 01/21, 02/21, etc... The Title however, lists track 01 as Chapter 1, so when the list of tracks are played, Chapter 1 is played, then Chapter 11, then 12, etc... then 2, then 21, etc...

So I'm trying to figure out how to rename only the tracks with a filename (or title) ending with a 1 - 9, so that they end with a 01, 02, etc..

I found a thread talking about the function of "Formatstring: $cutLeft(%_filename%,17)" which at first I thought could modify to do what I needed, but then decided that it really wasn't the solution without a lot of additional work. Other threads didn't give me much hope either.

I could accomplish this manually, but I have about 300 tracks to modify :frowning:

Any help would be appreciated!


instead of simply using %track% to write the track number use

So in order to get the filename with padded numbers try the converter Tag-Filename and the mask
%title% - $num(%track%,2)

Thanks ohrenkino,

That's close, by using that mask the filename changes from "Chapter 1.flac" to - "Chapter 1 - 01.flac".

What I'd like to have is just Chapter 01.flac. Is that possible?

Instead of trying to change the filename you should build it complete new with "covert Tag-Filename".
That naturally only works, if your filename ist build of filled tags.

If you don't want to fully re/create the filename from the values of the tag fields by a fitting format string, then you may use the converter "Tag - Filename" with one format string from the following proposals ...

$trimRight(%_filename%,'0123456789 -_.()#''') $regexp(%_filename%,'[\d\s\-_.()#'''']+$',%DUMMY%)

These format strings may remove more characters from the right edge of the filename as you want it, but I am sure, that you are able to adapt the examples to your need.

Afterwards you can concatenate the track number formatted as you wish, e. g. with a format string like ...

%_filename%' '$num(%TRACK%,2)

In the event that a track number does not exist, then you may apply this format string ...


... or ...

$trimRight(%_filename%,' 0123456789')' '$num(%_counter%,2)


Thanks DetlevD, that's exactly what I needed!

I had no idea MP3Tag was so powerful, it reminds me of when I was struggling with formulas in Excel...

I ended up combining both statements and was able to batch process large quantities of files at once.
$trimRight(%filename%,'0123456789 -.()#''')' '$num(%TRACK%,2)

Thanks again!!