# Mass Tag/Filename Conversion

**URL:** https://community.mp3tag.de/t/mass-tag-filename-conversion/11663
**Category:** Support
**Created:** [March 4, 2011, 2:43am UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663 "2011-03-04T02:43:13Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![bd59903](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bd59903](https://community.mp3tag.de/u/bd59903)
#### Post date: [March 4, 2011, 2:43am UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/1 "2011-03-04T02:43:13Z")

</div>

I use mp3tag for my HUGE audiobook collection  
at the moment I do the following steps 1 at a time:

1. tag track #s
2. rename file according to directory (track # - directory)
3. get tag values from file name (title, author, album(series name) etc)
4. change title to "title - track #"

I think i can do this all in one step using "actions" but i cannot figure out how to handle the fact that in mass processing, some books have album values (series name) while others are "stand alone" books

any ideas?

---

<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: [March 4, 2011, 5:05am UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/2 "2011-03-04T05:05:03Z")

</div>

> [@bd59903](#):
>
> ... some books have album values (series name) while others are "stand alone" books...  
> any ideas?

I am afraid that without any concrete examples for each variation it is very hard to help as very often a single dot or blank in an action make all the difference.

---

<div class="post-metadata">

### Author: ![bd59903](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bd59903](https://community.mp3tag.de/u/bd59903)
#### Post date: [March 4, 2011, 1:45pm UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/3 "2011-03-04T13:45:24Z")

</div>

> [@ohrenkino](#):
>
> I am afraid that without any concrete examples for each variation it is very hard to help as very often a single dot or blank in an action make all the difference.

right  
some books are named

(track#) - (Author/Artist) - (Novel/Title).mp3

Others are

(track#) - (Author/Artist) - (Series/Album) - (Novel/Title).mp3

---

<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: [March 5, 2011, 4:08pm UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/4 "2011-03-05T16:08:15Z")

</div>

> [@bd59903](#):
>
> right  
> some books are named  
> (track#) - (Author/Artist) - (Novel/Title).mp3  
> Others are  
> (track#) - (Author/Artist) - (Series/Album) - (Novel/Title).mp3

I assume that all information is somewhere in the filename, right (why isn't it in the tags straight away? Filenames are only for dumb players that do not look at the tags).  
Also I fear that you first name the files and then extract the information to fill the tags. I would recommend to do it the other way round.

Now, down to the other business.  
I think that an action of the type "Guess value" would cater for most of your steps in one go:

Create a new action group for the standalone books  
first action:  
"Guess value"  
select the field %\_filename%  
enter as mask  
%track% - %Artist% - %Title%

second action:  
Format tag field: Title  
Value:  
%title% $num(%track%,3)

do a similar thing for the books of a series.  
First action like the first above but with a modified mask:

%track% - %Artist% - %album% - %Title%  
or if you want to have series and title in the same field then the mask looks just like this:  
%track% - %Artist% - %Title% - %Title%

second action like the second action for standalone books.

Is this, what you wanted?

Another general note: data structures that use implicit fields coded by their position always collapse if that position is not filled.  
In your case a structure

```
Series Standalone
1: Number 1: Number
2: Artist 2: Artist
3: Series     
4: Title 3: Title

```

falls one piece of the data short if position 3 is not filled.  
So you either have to fill this position or treat the structure with a different procedure.

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [March 5, 2011, 6:33pm UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/5 "2011-03-05T18:33:32Z")

</div>

> [@bd59903](#):
>
> I use mp3tag for my HUGE audiobook collection  
> at the moment I do the following steps 1 at a time:
> 
> 1. tag track #s
> 2. rename file according to directory (track # - directory)
> 3. get tag values from file name (title, author, album(series name) etc)
> 4. change title to "title - track #"
> 
> I think i can do this all in one step using "actions" but i cannot figure out how to handle the fact that in mass processing, some books have album values (series name) while others are "stand alone" books

Create a Action Group (FAQs: [Actions](https://community.mp3tag.de/t/967/2) ) with the following:

1. tag track #s  
Action: Format Value  
Field: TRACK  
Formatstring: %\_counter%  
(this can't reset the tracknumber for every folder. if this function is needed, you have to put this out for the actiongroup and use the Track Number Wizard, which can't be used as part of a action group)

2. rename file according to directory (track # - directory)  
Action: Format Value  
Field: \_FILENAME  
Formatstring: %track% - %\_directory%

3. get tag values from file name (title, author, album(series name) etc)  
Action: Guess Values  
Source Format: $if($eql($regexp($regexp(%\_filename%,._?( - )._?,$1),(.\* - )._,$1), - - ),$regexp(%\_filename%,(._) - (.\*),$1 - - $2),%\_filename%)Guessing Pattern: %track% - %artist% - %album% - %title%

4. change title to "title - track #"  
Action: Format Value  
Field: TITLE  
Formatstring: %title% - %track%

edit:  
step 3 adjusted according the discussion below

---

<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: [March 6, 2011, 10:45am UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/6 "2011-03-06T10:45:30Z")

</div>

> [@bd59903](#):
>
> I use mp3tag for my HUGE audiobook collection at the moment I do the following steps 1 at a time:
> 
> 1. tag track #s
> 2. rename file according to directory (track # - directory)
> 3. get tag values from file name (title, author, album(series name) etc)
> 4. change title to "title - track #"  
> ...

Is the sequence of step 2 and 3 correct?  
If so ... does it mean, that ...  
_"tag values from file name (title, author, album(series name) etc)"_  
... are part of the directory name?  
That sounds rather confusing. You should check your procedure.

For working on files with different structure of the file name it is recommended to simply use the Mp3tag Filter.

This filter expression reduces the amount of files in the list view to those files which are constructed of 3 parts divided by 2 times ' - ', that means the filter expression detects the number of delimiter strings.

**"$div($sub($len(%\_filename%),$len($replace(%\_filename%,' - ',))),$len(' - '))" IS 2**

This filter expression reduces the amount of files in the list view to those files which are constructed of 4 parts divided by 3 times ' - ', that means the filter expression detects the number of delimiter strings.

**"$div($sub($len(%\_filename%),$len($replace(%\_filename%,' - ',))),$len(' - '))" IS 3**

If you like to put the importance on the parts, then you can modify the filter expression to detect the number of value parts, in this case 4 parts.

**"$add(1,$div($sub($len(%\_filename%),$len($replace(%\_filename%,' - ',))),$len(' - ')))" IS 4**

DD.20110306.1302.CET

---

<div class="post-metadata">

### Author: ![bd59903](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bd59903](https://community.mp3tag.de/u/bd59903)
#### Post date: [March 8, 2011, 12:03am UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/7 "2011-03-08T00:03:43Z")

</div>

> [@DetlevD](#):
>
> Is the sequence of step 2 and 3 correct?  
> If so ... does it mean, that ...  
> _"tag values from file name (title, author, album(series name) etc)"_  
> ... are part of the directory name?  
> That sounds rather confusing. You should check your procedure.

I have to do it that way because most of the time the mp3 do not come with tag values i want/find useful, and the file names are the same  
so i rename the folder as "'Author' - 'Series' # - 'Title'" then do from there

so what you are saying is that i can create action group to apply filter to use only those with 2 parts in filename, do everything i want  
then apply filter to use files with 3 parts, etc?

---

<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: [March 8, 2011, 3:24am UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/8 "2011-03-08T03:24:25Z")

</div>

> [@bd59903](#):
>
> I have to do it that way because most of the time the mp3 do not come with tag values i want/find useful, and the file names are the same so i rename the folder as "'Author' - 'Series' # - 'Title'" then do from there ...

Do you know that you can create user defined tag fields as you wish? ... and remove ... and use for all the things you want to do? You can use tag fields like temporary variables. You do not have to misuse folder names to store data. The filesystem does not support all characters and so there is loss of spelling accuracy to be expected.

> [@bd59903](#):
>
> ... so what you are saying is that i can create action group to apply filter to use only those with 2 parts in filename, do everything i want  
> then apply filter to use files with 3 parts, etc?

Yes, divide and conquer, that's the strategy.  
The filter is part of the interactive interface of Mp3tag, the actions are part of the batch automatiion interface of Mp3tag. Both together makes tagging life easy.

DD.20110308.0528.CET

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [March 8, 2011, 8:45am UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/9 "2011-03-08T08:45:55Z")

</div>

my 4 step solution has the filter inbuilt to the formatstring by using a $if function and works fine. but do as you want

---

<div class="post-metadata">

### Author: ![bd59903](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bd59903](https://community.mp3tag.de/u/bd59903)
#### Post date: [March 8, 2011, 3:27pm UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/10 "2011-03-08T15:27:27Z")

</div>

i can figure out how to use the filters from the other guy in actions so i tried yours

it worked except for the TITLEs, it gets the track, artist, album, but does not get the title  
from either the files with "track - artist - title.mp3"  
or the ones that are "track - artist - album - title.mp3"  
any ideas?

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [March 8, 2011, 5:31pm UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/11 "2011-03-08T17:31:01Z")

</div>

> [@bd59903](#):
>
> i can figure out how to use the filters from the other guy in actions so i tried yours
> 
> it worked except for the TITLEs, it gets the track, artist, album, but does not get the title  
> from either the files with "track - artist - title.mp3"  
> or the ones that are "track - artist - album - title.mp3"  
> any ideas?

ah yes, there was a little mistake caused by the forum's unability to display two following spaces.

that's the way:

```
3. get tag values from file name (title, author, album(series name) etc)
Action: Guess Values
Guessing Pattern: $if($eql($regexp($regexp(%_filename%,.*?( - ).*?,$1),(.* - ).*,$1), - - ),$regexp(%_filename%,(.*) - (.*),$1 - - $2),%_filename%)
Formatstring: %track% - %artist% - %album% - %title%

```

but already it should have worked for the ones which are written "track - artist - album - title.mp3"

---

<div class="post-metadata">

### Author: ![bd59903](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bd59903](https://community.mp3tag.de/u/bd59903)
#### Post date: [March 8, 2011, 10:24pm UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/12 "2011-03-08T22:24:20Z")

</div>

QUOTE (pone @ Mar 8 2011, 19:31) \<{POST\_SNAPBACK}\>

ah yes, there was a little mistake caused by the forum's unability to display two following spaces.

that's the way:

```
3. get tag values from file name (title, author, album(series name) etc)
Action: Guess Values
Guessing Pattern: $if($eql($regexp($regexp(%_filename%,.*?( - ).*?,$1),(.* - ).*,$1), - - ),$regexp(%_filename%,(.*) - (.*),$1 - - $2),%_filename%)
Formatstring: %track% - %artist% - %album% - %title%

```

but already it should have worked for the ones which are written "track - artist - album - title.mp3"

nope, i dont know if i am doing something wrong but the TITLE is still not being grabbed from the filename

guess value,  
Source Format: %track% - %artist% - %album% - %title%  
Guessing Pattern:  
$if($eql($regexp($regexp(%\_filename%,._?( - )._?,$1),(.\* - )._,$1), - - ),$regexp(%\_filename%,(._) - (.\*),$1 - - $2),%\_filename%)

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [March 8, 2011, 11:23pm UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/13 "2011-03-08T23:23:17Z")

</div>

> [@bd59903](#):
>
> nope, i dont know if i am doing something wrong but the TITLE is still not being grabbed from the filename
> 
> guess value,  
> Source Format: %track% - %artist% - %album% - %title%  
> Guessing Pattern:
> 
> ```
> $if($eql($regexp($regexp(%_filename%,.*?( - ).*?,$1),(.* - ).*,$1), - - ),$regexp(%_filename%,(.*) - (.*),$1 - - $2),%_filename%)
> 
> ```

I'm sorry. I'm using Mp3Tag in German and I've messed up the terms _Source Format_ & _Guessing Pattern_.  
It's:  
**Source Format:**  
$if($eql($regexp($regexp(%\_filename%,._?( - )._?,$1),(.\* - )._,$1), - - ),$regexp(%\_filename%,(._) - (.\*),$1 - - $2),%\_filename%) **Guessing Pattern:** %track% - %artist% - %album% - %title%

---

<div class="post-metadata">

### Author: ![bd59903](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bd59903](https://community.mp3tag.de/u/bd59903)
#### Post date: [March 9, 2011, 2:48pm UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/14 "2011-03-09T14:48:27Z")

</div>

> [@pone](#):
>
> I'm sorry. I'm using Mp3Tag in German and I've messed up the terms _Source Format_ & _Guessing Pattern_.  
> It's:  
> **Source Format:**
> 
> ```
> $if($eql($regexp($regexp(%_filename%,.*?( - ).*?,$1),(.* - ).*,$1), - - ),$regexp(%_filename%,(.*) - (.*),$1 - - $2),%_filename%)<b>Guessing Pattern:</b> %track% - %artist% - %album% - %title%
> 
> ```

thank works, thanks for your help

---

<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: [February 9, 2026, 12:22pm UTC](https://community.mp3tag.de/t/mass-tag-filename-conversion/11663/15 "2026-02-09T12:22:57Z")

</div>


