Conditional Formatting Tag - Filename


I use MP3TAG to move content into the library to a consistent structure.
I am building 1 action to 'rule them all', so any and all content is moved into the library in a consistent way.

I like to store artists with 'The ' in front with ', The' in the back
W:\Music\Artist, The...
Discnumbers 1 or 1\X - i want to add to end of album Folder path (CD1) and ideally have the Albumname as root.
W:\Music\Artist(Year) Album with two discs
W:\Music\Artist(Year) Album with two discs\Album with two disc (CD1)\tracks
W:\Music\Artist(Year) Album with two discs\Album with two disc (CD2)\tracks
(i'll need to handle various use cases of no disc number, discnumber alone, discnumber\totaldiscs.)

using some advice on here on regular expressions i added a conditional option to the tag to filename function, for the artist bit.

W:\Music$IF($eql($left(%albumartist%,4),The ),$regexp(%albumartist%,^The (.+),'$1, The'),%albumartist%)(%year%) %album%$num(%track%,2). %title%

however it turns out that $regexp has a conditional characteristic. This also works

W:\Music$regexp(%albumartist%,^The (.+),'$1, The')(%year%) %album%$num(%track%,2). %title%

but i guess $regexp can only offer conditional logic on the characters in expression. When i build this out for 'Discnumbers in path / (CD1)' ill need to use the $IF function again...

has anyone done this already or got their own single action that formats all content into paths to a set criteria based on such matters as the above eg discnumbers, to give me ideas on best practise/options.

thank you

Ordner umbennen so das CD1 und CD2 usw

W:\Music$regexp(%albumartist%,^The (.+),'$1, The')(%year%) %album%$if($nequal(%discnumber%,''),$regexp(\CD %discnumber%,(\CD 1/1)|((\CD .)/.),$3),)$num(%track%,2). %title%

In case it helps, i borrowed some advice from the forums for above, which seems to work - test 1st.

If artist starts with 'The ' store in file system as artist, The.
If the discnumber field is populated as X or X\Y, store Multiple discs as subfolders to the album 'CD 1', 'CD 2' etc, otherwise dont create a disk subfolder.


W:\Music$regexp(%albumartist%,^The (.+),'$1, The')(%year%) %album%$if($nequal(%discnumber%,""),(%year%) %album% CD$fmtNum(%discnumber%),)$num(%track%,2). %title%

works and is simpler