Help with music library reorganization

Hello, this is my first post here so don't be surprised if I sound like a novice. I'm reorganizing my music library which is a complete mess. The tags are pretty accurate but the file naming and folder hierarchy is a complete catastrophe. The library is 5 years old and houses 40000 songs. I'm trying to come up with a format that looks like this:

  1. Files would be named like "Track number - Title"
  2. Directory would be at a specific folder and so it's like "Absolute directory\Album Artist - Album - Year - Bitrate - VBR/CBR"
  3. If it's a multidisc album, there would be a subfolder named like "Disc 1, Disc 2 ... etc."

I've come up with this script so far:
"_FILENAME": $num(%track%,2) - %title%
"_DIRECTORY": X:\Music\$validate(%albumartist% - %album% - %year% - %_bitrate% - %_vbr%\Disc %discnumber%,_)

Now, the problems are:

  1. If any of the fields are not present, it creates a " - - " which looks very weird
  2. I want the disc number to include the first portion only. That is, if it's '1/2', then the subfolder should be 'Disc 1' only. But I'm getting the output as Disc 1_2. Also, if there's no discnumber, it's generating a subfolder named 'Disc ' which is actually another instance of the first problem. I don't want Mp3tag to create a subfolder for albums that don't have multiple discs.
  3. I realized that lots of my tracks have the year field missing. How can I fix the tag for those? I want to change the year field only. And discogs usually has multiple pressings of the same album but I'd only want the earliest year.
  4. VBR tracks would probably generate each folder of its own with an estimated bitrate. That's a complete mess. I want it to be like X - Y - 2000 - V0 - VBR if it's a VBR and X - Y - 2000 - 320 - CBR if it's a CBR album.

I do understand the limitations are due to my incomplete script and so I'd be glad if you guys can show me the way. Thanks.

X:\Music\$validate([%albumartist% - ][%album% - ][%year% - ]%_bitrate% - %_vbr%\[Disc $left(%discnumber%,1)],_)

Personally I would not create such a monstrum of folder with information that can be easily gained from the tags, even in the windows explorer.

If you use the Converter "Tag ->Filename" instead of an action for %_directory% you can put both actions together and you have the benefit of seeing the result in the preview.

X:\Music\$validate([%albumartist% - ][%album% - ][%year% - ]%_bitrate% - %_vbr%\[Disc $left(%discnumber%,1)],_)\$num(%track%,2) - %title%

1 Like

Thank you so much. The only caveat is the %_bitrate% generating multiple folders on VBR tracks but I guess I'll drop that from naming scheme.

You could use:
X:\Music\$validate([%albumartist% - ][%album% - ][%year% - ][$if($eql(%_vbr%,CBR),%_bitrate% - ,)]%_vbr%\[Disc $left(%discnumber%,1)],_)\$num(%track%,2) - %title%

Thank you, this does the trick.

Two intercalations to consider, before you start re-working 40 000 files

1] You will eventually run out of space- thus run into troubles with moving / coping / deleting files

2] How will you tell apart a data that has a

 - 

in it [like a name of an album] from your marker, for which you have chosen

 -

?