# Help with ML reorganization

**URL:** https://community.mp3tag.de/t/help-with-ml-reorganization/6472
**Category:** Support
**Created:** [March 18, 2008, 4:22pm UTC](https://community.mp3tag.de/t/help-with-ml-reorganization/6472 "2008-03-18T16:22:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![MarcoakaP](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@MarcoakaP](https://community.mp3tag.de/u/MarcoakaP)
#### Post date: [March 18, 2008, 4:22pm UTC](https://community.mp3tag.de/t/help-with-ml-reorganization/6472/1 "2008-03-18T16:22:18Z")

</div>

Hi all guys, I'd like to reorganize my music library but I'm a real noob when it comes to regexs.  
Well, all my mp3s are in a big folder and are properly tagged.  
I would like to put them in a directory structure like this:

+% **Album artist** %  
.....+% **Album title** % **(published in** % **year** %**)**  
..........+if there are more discs -\> **Disc** % **disc** % **of** % **totaldisc** % **,**  
\_\_\_\_\_\_\_if there's just one disc -\> _nothing_  
\_\_\_\_\_\_\_and in _both_ cases after the two options above (after the comma) -\>  
\_\_\_\_\_\_\_ **track** % **track** % **of** % **totaltrack** % **.** % **actualfilenamewithext** %  
+% **Composer** %  
.....+ **Composed in** % **year** %  
..........+% **actualfilenamewithext** %

I hope I've been clear the most. I want to underline that mp3s with %albumartist% do not have %composer% tag and viceversa, I hope this helps.

TIA to everybody willing to spend time for this (at least for me) challenge.

---

<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 18, 2008, 5:28pm UTC](https://community.mp3tag.de/t/help-with-ml-reorganization/6472/2 "2008-03-18T17:28:57Z")

</div>

> [@MarcoakaP](#):
>
> ... Well, all my mp3s are in a big folder and are properly tagged. I would like to put them in a directory structure like this: ...

Your description was helpful, and there are properly tagged files.  
So you may try following actiongroup.

1. Choose a subset of your files to play around with and be aware to loose them.
2. Choose a rootfolder where the new tree of files should be created, write it to action #1.
3. Run the actiongroup (note: modify action #3 for test mode).
4. Check if FILENAME\_NEW contains the filepathes you need.
5. If all looks good, then run the actiongroup (note: modify action #3 for reality mode).
6. Ready.

Begin Actiongroup **TEST**

Action #1  
_Actiontype 5:_ **Format tag field**  
_Field:_ **RF**  
_Formatstring:_ **O:\TEST\ROOTFOLDER** _(choose a rootfolder of your own)_

Action #2  
_Actiontype 5:_ **Format tag field**  
_Field:_ **FILENAME\_NEW**  
_Formatstring:_ **$if(%composer%,%rf%\%composer%\%year%\%\_filename\_ext%,$ifgreater(%totaldisc%,1,%rf%\%albumartist%\%albumtitle%÷'('%year%')'\disc÷%disc%÷of÷%totaldisc%','÷track÷%track%÷of÷%totaltrack%.÷%\_filename\_ext%,%rf%\%albumartist%\%albumtitle%÷'('%year%')'\track÷%track%÷of÷%totaltrack%.÷%\_filename\_ext%))**

Action #3  
_Actiontype 5:_ **Format tag field**  
_Field:_ **\_FILENAME**  
_Formatstring:_ **%\_FILENAME%** _(should change nothing while testing)_

Action #3  
_Actiontype 5:_ **Format tag field**  
_Field:_ **\_FILENAME**  
_Formatstring:_ **%FILENAME\_NEW%** _(create new foldertree and move files)_

Action #4  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **RF;FILENAME\_NEW**

Note: Replace one special character ÷ with one space character.  
End Actiongroup **TEST** (4 Actions)

Good luck!  
DD.20080318.1928.CET

---

<div class="post-metadata">

### Author: ![MarcoakaP](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@MarcoakaP](https://community.mp3tag.de/u/MarcoakaP)
#### Post date: [March 19, 2008, 1:54pm UTC](https://community.mp3tag.de/t/help-with-ml-reorganization/6472/3 "2008-03-19T13:54:17Z")

</div>

Ok, you look pro with regexs, but I'm a user who wants to understand what he does and the more I play with the more problem rise.  
Well the first problem comes from track numbers, the way you decribed produces results like xxy in the filename from xx/y looking tags. Then the discnumber doesn't show in case of multicd album.  
I played a little and discovered that I can do the work even from the tag-\>filename panel, and digging in the forum I discovered several interesting formatting inputs.

%band%\%album% '('%year%')'$validate(%track%, of ). %\_filename%

A good base for my job, but it lacks the condition band vs composer, the discnumber condition, plus I'd want it to show two-digit track numbers. Here's what I'm trying to obtain:

Normal music has the %band% field, so

%band%\%album% '('%year%')'\ ***something for discnumber with the validate thing for removing the slash** \*$validate(%track%, of ). %\_filename%

Example: "The Who\Quadrophenia (1973)\Disc 1 of 2, track 01 of 10. The Who - I Am the Sea.mp3"

Classical music has the %composer% field, so

%composer%\Composed in %year\%\_filename%  
That's easier, I just need to merge it with the above one.

---

<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 19, 2008, 2:21pm UTC](https://community.mp3tag.de/t/help-with-ml-reorganization/6472/4 "2008-03-19T14:21:10Z")

</div>

> [@MarcoakaP](#):
>
> Ok, you look pro with regexs, ...

There was no regexp involved, this was just plain use of your given tagfield names and two functions $if() and $ifgreater() and your given logic.

I know that the TRACK tag field can be formatted as 'n' (track) or somewhat like 'nn/nn' (track/totaltracks) (so DISCNUMBER too), but you've said that you have properly filled tags on which you have referred going along with your description.

And I thought you are familiar with Mp3tag and tagging in general, so you should know that a DISCNUMBER tag field is a user field, that you have to fill in with proper values (so far as I know).

> [@MarcoakaP](#):
>
> ... Disc 1 of 2, track 01 of 10. The Who - I Am the Sea.mp3" ...

Avoid such filenames, I do not think that they are sortable in correct order.

You may play around with the following actiongroup.

Begin Actiongroup **TEST**

Action #1  
_Actiontype 5:_ **Format tag field**  
_Field:_ **TMP\_RF**  
_Formatstring:_ **O:\TEST\ROOTFOLDER**

Action #2  
_Actiontype 5:_ **Format tag field**  
_Field:_ **TMP\_T**  
_Formatstring:_ **$regexp(%track%,0\*(\d+)/0\*(\d+),$1)**

Action #3  
_Actiontype 5:_ **Format tag field**  
_Field:_ **TMP\_TT**  
_Formatstring:_ **$regexp(%track%,0\*(\d+)/0\*(\d+),$2)**

Action #4  
_Actiontype 5:_ **Format tag field**  
_Field:_ **TMP\_D**  
_Formatstring:_ **$regexp(%discnumber%,0\*(\d+)/0\*(\d+),$1)**

Action #5  
_Actiontype 5:_ **Format tag field**  
_Field:_ **TMP\_DT**  
_Formatstring:_ **$regexp(%discnumber%,0\*(\d+)/0\*(\d+),$2)**

Action #6  
_Actiontype 5:_ **Format tag field**  
_Field:_ **TMP\_FN**  
_Formatstring:_ **$if(%composer%,%TMP\_RF%\%composer%\%year%\%_filename\_ext%,$ifgreater(%TMP\_DT%,1,%TMP\_RF%\%artist%\%album%÷'('%year%')'\D.%TMP\_DT%.%TMP\_D%'_'T.%TMP\_TT%.%TMP\_T%'\_'%_filename\_ext%,%TMP\_RF%\%artist%\%album%÷'('%year%')'\T.%TMP\_TT%.%TMP\_T%'_'%\_filename\_ext%))**

Action #7  
_Actiontype 5:_ **Format tag field**  
_Field:_ **\_FILENAME**  
_Formatstring:_ **%TMP\_FN%**

Action #8  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **TMP\_RF;TMP\_T;TMP\_TT;TMP\_D;TMP\_DT;TMP\_FN**

Note: Replace one special character ÷ with one space character.  
End Actiongroup **TEST** (8 Actions)

DD.20080319.1621.CET

---

<div class="post-metadata">

### Author: ![MarcoakaP](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@MarcoakaP](https://community.mp3tag.de/u/MarcoakaP)
#### Post date: [March 19, 2008, 2:44pm UTC](https://community.mp3tag.de/t/help-with-ml-reorganization/6472/5 "2008-03-19T14:44:24Z")

</div>

Oh yeah, now I've understood the logic behind that all! Works perfectly now, thanks!

---

<div class="post-metadata">

### Author: ![MarcoakaP](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@MarcoakaP](https://community.mp3tag.de/u/MarcoakaP)
#### Post date: [March 19, 2008, 3:27pm UTC](https://community.mp3tag.de/t/help-with-ml-reorganization/6472/6 "2008-03-19T15:27:50Z")

</div>

A simpler solution (since classical music mp3s are less I can select'em by myself):

%band%$validate(%album%,-) (%year%)[\Disco [$num(%discnumber%,1)]][$num(%track%,2)]. %\_filename%

%composer%\%year%\%\_filename%

---

<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:20pm UTC](https://community.mp3tag.de/t/help-with-ml-reorganization/6472/7 "2026-02-09T12:20:50Z")

</div>


