How to capitalize the first letter of the filename ?


Thanks for this fantastic software !

I want to do that (i found a solution for the tag fields)

01 - ALABAMA SONG.mp3 to 01 - Alabama songs.mp3

I don't find solution for the filename.


One of many possible solutions:
Use "Convert > Filename - Filename"
Old filename pattern:
%1 - %2
New filename pattern:
%1 - $caps(%2)

Thank's this work as this : %1 - $caps3(%2) to have only the first letter of the filename.

I tried to build an action :

But this action doesn't work...

What is your reason to use an action "Replace" but not "Tag format" or "Guess values" or such other?


I tried, but with no result.

Sorry, but i don't understand how to do with an action.

I only want the first letter of the filename in upper case.

I made different attempts to try to understant what syntax to use and i found this :

strange result :

Just use $caps3(%_filename%) and make sure you've read Mp3tag Help - Scripting Fuctions.

Off course, I red the help, but in this case the $caps3(%_filename%) function doesn't do nothing...

So, what is it doing then? :rolleyes:

If i apply $caps3(%_filename%) to 01..hard as rock.mp3 the result is 01..hard as rock.mp3 and not what i want :

01..Hard as rock.mp3

I undestood the $caps3() function, it's capitalize the first letter of the filename (in this case) but the first caracter is not a letter but a number.

This probably explain the result.

But perhaps, i'm false...

Please read the help file carefully, especially
section "Case conversion Sentence"
The $caps3 function allows to define an optional second parameter, which can trigger the conversion by user defined character.
What do you think which character is useful for your example?


Hi Aboulafia

If you always want your filenames starting
track number - Trackname

and assuming you want a two digit track number from the tag and the title from the track tag

$num(%track,2) - $caps3(%Title)

Good Luck

I hope you meant:
Format value
$num(%track%,2) - $caps3(%Title%)

If the OP is not a programmer he'll probably find the info about the 2nd parameter impossible to understand. I've programmed for nearly 30 years and it leaves me wondering what /precisely/ it means.

Also the 'template' for, for example, $caps3 doesn't actually show that a second parameter is possible. I presume it should say something like - either formally:


or more loosely


It'd be simpler though if you simply listed both valid forms, tellings users that they can either use it like:




and give separate examples of the two ways of using the function.

Without examples it's not obvious what the 'chars' value should look like. Does it need to be in quotes? Single or double quotes? Or a comma-separated list of possible chars? Is it possible to specify a space as one of the chars? Can one specify a regex character class?

Are we telling the function to start the conversion as soon as it sees a particular character (and include that character as one that can be converted), or will the first converted character be after the matching one?

Would the OP need to code something like $caps3(string,'-')
to turn conversion on only after a "-" has been seen?

Mea culpa, mea culpa

yes I did

:blush: Pegleg

Perhaps this discussion needs moving to another thread

One I don't understand is the simple Replace
How do I get the additional pairs of from/to parameters.

Command: $replace(string,from,to) or $replace(string,from1,to1,from2,to2,...)
Example: $replace(%artist% - %album% - %track% - %title%,_,-)
This example replaces all underscores to dashes. You can provide additional pairs of from/to as parameters.


I would love this to work then I can simplify the long list of accented character replacements

Replace "_ALL":"Ä"->"A"


Replace "_ALL":"ü"->"u"

Should simply become
Replace "_ALL":"Ä"->"A","ä"->"a"........"ü"->"u"


Hi Robin Hood, avenger of the scholars, savior of the unlearned. You are right!

Generally I like this kind of documentation.

Florian has often declared that he is open for a new and better documentation if someone else will do it for the community.

But for now Mp3tag scripting language remains as a trial and error adventure, so that each scripter is required to use his own brain grease, with a little help from the community of course.


  • This not completly exact.
    It converts the given string to first "caracter" upper case and not first "letter". If the first caracter of the given string is a number (01..hard....) it does do nothing. See screen shots:

Result :

With letter :

Result :

Can you give me an example of second parameter, please ?

This can be helpful.

$caps3(%_filename%,.) upper case after dot

$caps3(%_filename%,. ) uper case after dot or space

%_FILENAME% = abc.def g'hi.mp3

Convertisseur | Tag -> Nom de fichier | ALT+1
Sélectionnez le format
Abc.def g'hi.mp3

Convertisseur | Tag -> Nom de fichier | ALT+1
Sélectionnez le format
Abc.Def g'hi.mp3

Convertisseur | Tag -> Nom de fichier | ALT+1
Sélectionnez le format
$caps3(%_FILENAME%,. '')
Abc.Def G'Hi.mp3


Thanks a lot for your help.

I made an action and it's work like a charm.

Too hard :book: