File name to tag with complicated folder structure


#1

I'ld like to rewrite the tags of all my songs cause some of them seem to be really messed up.

My music is organized in folders. Mostly:
\Genre\Artist\Year - Album\Track# - Title
That converts easily to the corresponding tag infos.

However if the album consists of more than one CD the folder structure turns to:
\Genre\Artist\Year - Album\CDn\Track# - Title
(where CDn means the nth CD of that particular album)

Is there a way to rewrite the tags in one batch without filtering the two possibilities mentioned above beforehand?

I tried $if to no avail. Probably my stupidity. Thanks in advance for any hints!


#2

You could try it with an action group with 2 actions:
Guess values
Source: %_filename%
Format string: %Genre%\%Artist%\%Year% - %Album%\%Track% - %Title%

Guess values
Source: %_filename%
Format string: %Genre%\%Artist%\%Year% - %Album%\CD%discnumber%\%Track% - %Title%

The first action always fills tags which is correct for albums without further CDs.
The second action only applies if there is a CD and will then overwrite the already imported data but only if the pattern matches. So albums without further CDs are left alone.
To be sure, I would use an absolute path.

And another thing:

Please note that the filename is not a very good backup storage for metadata. There are a number of invalid characters for filenames in the various names and titles.(e.g. ? * > < /\ - so "A*Teens" would be messed up just like Axwell /\ Ingrosso or AC/DC, the track "What have I done to deserve this?" would appear without the "?" and so on)
So if you have these characters already in your tags then do not overwrite them with the data from the filenames as you would loose these characters.