# Create tag from filename

**URL:** <https://community.mp3tag.de/t/create-tag-from-filename/59166>\
**Category:** Support\
**Created:** [November 22, 2022, 8:25am UTC](https://community.mp3tag.de/t/create-tag-from-filename/59166 "2022-11-22T08:25:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![woezel1980](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/db5fbb/32.png) [@woezel1980](https://community.mp3tag.de/u/woezel1980)\
**Post date:** [November 22, 2022, 8:25am UTC](https://community.mp3tag.de/t/create-tag-from-filename/59166/1 "2022-11-22T08:25:17Z")

</div>

Hello,

I have a bunch of filenames that I would like to use to create the tracknumbers from.

For example:  
2007\_014[CD][PB] Gerard Joling - Maak Me Gek.mp3  
The track number should be 14

Note that there are a few with an "a'" or "b", for example  
2007\_269a[CD][PB] Katie Melua - Shy Boy.mp3  
The track should be 269 here.

I know how to remove the first part ('" 2007\_'"), by entering:

> 2007\_%track%

but how do I remove the last part ("[CD][PB].....")?

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [November 22, 2022, 8:40am UTC](https://community.mp3tag.de/t/create-tag-from-filename/59166/2 "2022-11-22T08:40:12Z")

</div>

> [@woezel1980](#):
>
> 2007\_%track%

Expand that to  
`2007_%track%[%dummy%`  
To get rid of the letters in the track number, run an action of the type "Format value afterwards or use Convert\>Tag-Tag for TRACK  
Format string: $num(%track%,1)

---

<div class="post-metadata">

**Author:** ![woezel1980](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/db5fbb/32.png) [@woezel1980](https://community.mp3tag.de/u/woezel1980)\
**Post date:** [November 22, 2022, 8:50am UTC](https://community.mp3tag.de/t/create-tag-from-filename/59166/3 "2022-11-22T08:50:22Z")

</div>

> [@ohrenkino](#):
>
> $num(%track%,1)

@ohrenkino  
It worked! Thanks a lot!

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [December 22, 2022, 8:50am UTC](https://community.mp3tag.de/t/create-tag-from-filename/59166/4 "2022-12-22T08:50:39Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
