# How to capitalize the first letter of the filename ?

**URL:** https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745
**Category:** General Discussion
**Created:** [August 9, 2009, 11:40am UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745 "2009-08-09T11:40:25Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Aboulafia](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Aboulafia](https://community.mp3tag.de/u/Aboulafia)
#### Post date: [August 9, 2009, 11:40am UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/1 "2009-08-09T11:40:25Z")

</div>

Hello,

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.

Regards.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [August 9, 2009, 2:37pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/2 "2009-08-09T14:37:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Aboulafia](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Aboulafia](https://community.mp3tag.de/u/Aboulafia)
#### Post date: [August 26, 2009, 1:38pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/3 "2009-08-26T13:38:10Z")

</div>

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

I tried to build an action :

![](http://img7.hostingpics.net/pics/278925mp3tag_1a.jpg)

But this action doesn't work...

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [August 26, 2009, 2:57pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/4 "2009-08-26T14:57:55Z")

</div>

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

DD.20090826.1857.CEST

---

<div class="post-metadata">

### Author: ![Aboulafia](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Aboulafia](https://community.mp3tag.de/u/Aboulafia)
#### Post date: [August 30, 2009, 1:33pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/5 "2009-08-30T13:33:32Z")

</div>

I tried, but with no result.

![](http://img8.hostingpics.net/pics/418703mp3tag_1.jpg)

![](http://img8.hostingpics.net/pics/958201mp3tag_2.jpg)

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 :

[![](http://img8.hostingpics.net/pics/648513mp3tag_3.jpg)](http://www.hostingpics.net/viewer.php?id=648513mp3tag_3.jpg)

strange result :

[![](http://img8.hostingpics.net/pics/896230mp3tag_4.jpg)](http://www.hostingpics.net/viewer.php?id=896230mp3tag_4.jpg)

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [September 1, 2009, 5:34pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/6 "2009-09-01T17:34:02Z")

</div>

Just use $caps3(%\_filename%) and make sure you've read [Mp3tag Help - Scripting Fuctions](https://docs.mp3tag.de/scripting).

---

<div class="post-metadata">

### Author: ![Aboulafia](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Aboulafia](https://community.mp3tag.de/u/Aboulafia)
#### Post date: [September 3, 2009, 2:11pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/7 "2009-09-03T14:11:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [September 3, 2009, 2:15pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/8 "2009-09-03T14:15:08Z")

</div>

> [@Aboulafia](#):
>
> ... doesn't do nothing...

So, what is it doing then? ![:rolleyes:](https://community.mp3tag.de/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif ":rolleyes:")

---

<div class="post-metadata">

### Author: ![Aboulafia](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Aboulafia](https://community.mp3tag.de/u/Aboulafia)
#### Post date: [September 6, 2009, 11:26am UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/9 "2009-09-06T11:26:58Z")

</div>

> [@Florian](#):
>
> So, what is it doing then? ![:rolleyes:](https://community.mp3tag.de/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif ":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.. **H** ard 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...

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [September 6, 2009, 1:25pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/10 "2009-09-06T13:25:16Z")

</div>

> [@Aboulafia](#):
>
> ... 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. ...

Please read the help file carefully, especially [https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)  
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?

DD.20090906.1725.CEST

---

<div class="post-metadata">

### Author: ![Pegleg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/b4bc9f/32.png) [@Pegleg](https://community.mp3tag.de/u/Pegleg)
#### Post date: [September 7, 2009, 6:09am UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/11 "2009-09-07T06:09:54Z")

</div>

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

Replace  
\_FILENAME  
$num(%track,2) - $caps3(%Title)

Good Luck  
Pegleg

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [September 7, 2009, 6:37am UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/12 "2009-09-07T06:37:33Z")

</div>

> [@Pegleg](#):
>
> Replace  
> \_FILENAME  
> $num(%track,2) - $caps3(%Title)

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

---

<div class="post-metadata">

### Author: ![JNicoll](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/898d66/32.png) [@JNicoll](https://community.mp3tag.de/u/JNicoll)
#### Post date: [September 7, 2009, 12:35pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/13 "2009-09-07T12:35:03Z")

</div>

> [@Florian](#):
>
> Just use $caps3(%\_filename%) and make sure you've read [Mp3tag Help - Scripting Fuctions](https://docs.mp3tag.de/scripting).

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:

```
$caps3(string[,charlist])

```

or more loosely

```
$caps3(string,chars)

```

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

```
$caps3(string)

```

or

```
$caps3(string,chars)

```

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?

---

<div class="post-metadata">

### Author: ![Pegleg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/b4bc9f/32.png) [@Pegleg](https://community.mp3tag.de/u/Pegleg)
#### Post date: [September 7, 2009, 12:53pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/14 "2009-09-07T12:53:27Z")

</div>

> [@dano](#):
>
> I hope you meant:  
> Format value  
> \_FILENAME  
> $num(%track%,2) - $caps3(%Title%)

Mea culpa, mea culpa

yes I did

![:blush:](https://community.mp3tag.de/uploads/default/original/1X/c5a064300f7d900a70c2196f6eee95e32dde9b52.gif ":blush:") Pegleg

---

<div class="post-metadata">

### Author: ![Pegleg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/b4bc9f/32.png) [@Pegleg](https://community.mp3tag.de/u/Pegleg)
#### Post date: [September 7, 2009, 1:24pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/15 "2009-09-07T13:24:02Z")

</div>

> [@JNicoll](#):
>
> 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.
> 
> CUT-----------------------------------------------------
> 
> Would the OP need to code something like $caps3(string,'-')  
> to turn conversion on only after a "-" has been seen?

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.

![:unsure:](https://community.mp3tag.de/uploads/default/original/1X/cfaeba84fe6704387c5b34dfdd8172bd51b6f533.gif ":unsure:")

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"

Pegleg

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [September 7, 2009, 1:31pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/16 "2009-09-07T13:31:47Z")

</div>

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

> [@JNicoll](#):
>
> ... $caps3(string[,charlist]) ... and give separate examples of the two ways of using the function.

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.

DD.20090907.1731.CEST

---

<div class="post-metadata">

### Author: ![Aboulafia](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Aboulafia](https://community.mp3tag.de/u/Aboulafia)
#### Post date: [September 8, 2009, 12:04pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/17 "2009-09-08T12:04:32Z")

</div>

> [@DetlevD](#):
>
> Please read the help file carefully, especially [https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)  
> section "Case conversion Sentence"

> [@](#):
>
> "Case conversion sentence extract..."  
> **Command: $caps3(string)  
> Example: $caps3(%artist% - %album% - %track% - %title%)  
> This example converts the given string to first letter upper case**

- 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 :

> [@](#):
>
> The second parameter is optional and specifies additional characters that triggers upper case.

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

This can be helpful.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [September 8, 2009, 12:48pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/18 "2009-09-08T12:48:08Z")

</div>

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

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

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [September 8, 2009, 1:42pm UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/19 "2009-09-08T13:42:12Z")

</div>

> [@Aboulafia](#):
>
> ... Can you give me an example of second parameter, please ? This can be helpful.

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

 

**Convertisseur** | **Tag -\> Nom de fichier** | **ALT+1**  
_Sélectionnez le format_  
Format:  
**$caps3(%\_FILENAME%)**  
Aperçu  
**Abc.def g'hi.mp3**

  

**Convertisseur** | **Tag -\> Nom de fichier** | **ALT+1**  
_Sélectionnez le format_  
Format:  
**$caps3(%\_FILENAME%,.)**  
Aperçu  
**Abc.Def g'hi.mp3**

  

**Convertisseur** | **Tag -\> Nom de fichier** | **ALT+1**  
_Sélectionnez le format_  
Format:  
**$caps3(%\_FILENAME%,. '')**  
Aperçu  
**Abc.Def G'Hi.mp3**

 

DD.20090908.1752.CEST

---

<div class="post-metadata">

### Author: ![Aboulafia](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@Aboulafia](https://community.mp3tag.de/u/Aboulafia)
#### Post date: [September 12, 2009, 11:00am UTC](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745/20 "2009-09-12T11:00:19Z")

</div>

Thanks a lot for your help.

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

Too hard ![:book:](https://community.mp3tag.de/uploads/default/original/1X/0036d5b68f6226c53f6c68abfd0a7b8096fd4505.gif ":book:")

[Next page](https://community.mp3tag.de/t/how-to-capitalize-the-first-letter-of-the-filename/8745.md?page=2)
