How to easily rename file with track total?


Hi folks, let me say again what a great tool MP3TAG is; too bad I'm a bit too dim to use all its features properly.

My question is:
Can anyone suggest an easy way to rename files that automatically includes the total number of tracks in the filename?

Here's what I mean.
I use the Autonumbering feature to give me a track field formatted like 001/144. Then I use the 'Tag->Filename' feature to give me a filename with the total number of tracks like this:

%artist% - %album% - $num(%track%,3) Of 144

This works fine, but I was wondering if there was a slightly more elegant way to do this than re-editing the 'Tag->Filename' formatstring with the total number of tracks from the second part of the %track% field.

Probably not, and it (obviously) isn't very important, but there seem to be a number of very helpful power users at this forum and I figured I'd throw it out there.

Thanks very muchly (isn't there a song 'Die Gedanken Sind Frei'?)


Hi Praxis!


%artist% - %album% - $left(%track%,$sub($strchr(%track%,/),1)) of $right(%track%,$sub($len(%track%),$strchr(%track%,/)))

instead (Track field should contain the total number of tracks)



Thanks, Nickless, it works like a charm, even though it gives me a headache even trying to parse exactly what is happening. Some folks were just born to be clueless end users, I'm afraid. :wacko:


And there's a simpler format string for use in the special case where you're acting on all the files of the given album. That is, given your example, if you select all 144 files for "renaming", you could use the format string:

%artist% - %album% - $num(%track%,3) Of %_total%

Note that %_total% gives the total number of selected files.

Not as general purpose or robust as Nickless' fine solution -- but easier to wrap your head around :slight_smile:



Another way to do this if you already format your track numbers with the totals is to use the $validate function.

Basically it allows you to replace characters not allowed in file names with another string.

For example, if you use:

$validate(%artist% - %track% , of )

It will convert the "/" in the track number to " of " which I believe is the result you wanted.