create a filename with optional portions


Hi, I would like to rename my files according to this scheme:

  • If there is not track number, I want my filename like this: Artist - Title
  • If there is track number then the name should follow this schme: (track) Artist - Title

I tried to use this action, but it doesn’t work. What am I doing wrong?
$validate($if($isdigit(%track%),’(’$num(%track%)’) ',2),)%artist% - %title%,_)


You could use the converter Tag-Filename and the mask
[(%track%) ]%artist% - %title%
The square brackets enclose the optional part


Unbelievable. Who would say it’s so easy.
Thank you.


If it is crucial for your naming filenames, that %track% has to be a number, this is the optional %track% part like you wanted it in the first way:

$if($isdigit(%track%),’(’$num(%track%,2)’)’ ,)


Not sure how much detail you want in your filenames but this is how I like my filenames…

If I have multi disc sets then I append the discnumber as in the format below. Inversely, no multi disc just %track% %title%

%discnumber%-%track% %title%

For example:

The Album “Days of Rising Doom” from AINA. Disc 2, Track 2 would look like this:

2-17 The Beast Within

(I also number all tracks sequentially from 1 - number of tracks … this seems to make it easier for some apps in the sorting process I have found)

I suppose the mechanics of it may be a bit confusing. But if you have the field %totaldiscs% or an equivalent this will work in your action group …

Action:Format Value

  1. Field: _FILENAME
  2. Format String: $ifgreater(%totaldiscs%,1,$left(%discnumber%,2)-$num(%track%,2) %title%,$num(%track%,2) %title%)

Hope this helps you…


Try this format string expression with an action of your choice …

$if(%TRACK%,'('$num(%TRACK%,2)') ',%DUMMY%)%ARTIST%' - '%TITLE%)

If you want to prepend the running disc number, then try this expression …

$ifgreater(%TOTALDISCS%,1,$num(%DISCNUMBER%,1)'-',%DUMMY%)$if(%TRACK%,'('$num(%TRACK%,2)') ',%DUMMY%)%ARTIST%' - '%TITLE%)



Thank you all for your tips.