Problem with folders containing tracks from multiple discs

Hello there, I've lost some of my MTA files following new Windows installation and can't fix it. Could someone please help?

Let's say I have a folder that contains the tracks from disc 1 and 2. The meta data is there and will either show as 1/1, 2/2 or 1 or 2. I want to detect which it is, add the information to each file depending on which disc it is from Album (Disc 1) or Album (Disc 2) and then use that to move the files into respective folders of the same name.

If I try a directory change, it moves all the files into Album (Disc 1), even though the meta data is present.

If the number of the source folders is smaller than the number of target folders then you have to format value the _FILENAME as each file is moved individually to the individual new location.
If you rename the _DIRECTORY, then all the files in that folder are moved to the new location.

Thanks for your reply. Could you please show me what that would look like?

The last action should be Format Value for _FILENAME instead of _DIRECTORY
Format string: A:\Music\Record\%artist%\%album%\[Disc $num(%discnumber%,1)\]%_filename%

1 Like

Thanks for your reply. Changing from _DIRECTORY to _FILENAME adds the folder structure to the FILENAME rather than adding the disc number to the META under ALBUM, which should be used to make the directory change?

If you rename a folder (_Directory) then all files in that folder are moved to the new location.
If you want to create a folder structure that features a new folder for some files, then you have to treat each file individually.
So if you have a folder structure that currently has all the files from several discs in just 1 folder, and the new folder structure should group together some files in a folder for disc 1 and others in a folder for disc 2 (etc.), then each file has to be looked at an moved to the new folder.
That is why you have to use the filename.

I don't understand how that translates into files being moved into respective folders though. Also, it presents issues with anything containing data relating to disc number other than DISCNUMBER. It could be that it produces various chains of (Disc ?) (Disc 1) for example when it takes the data from the ALBUM NAME and DISCNUMBER.

you use
Format string: A:\Music\Record\%artist%\%album%\[
in the last action to rename the _DIRECTORY - and if I understand your problem correctly, you want to dstribute files from an existing folder "a" to a folder "a\Disc 1" or "a\Disc 2".
Is that correct so far?

Yep.

Let's say Phantom of the Opera.

Originally:
Phantom of the Opera>Phantom of the Opera Soundtrack

Desired:
Phantom of the Opera>Phantom of the Opera Soundtrack (Disc 1)
Phantom of the Opera>Phantom of the Opera Soundtrack (Disc 2)

The file name should be in the format %TRACK% %TITLE% once it's in the corresponding folder.

As I said: as soon as the number of target folders is smaller than the number of existing folders, you have to rename the file and not the whole folder.
A way would be: filter for files with DISCNUMBER =2.
Rename these files so that they are moved to a folder like
Phantom of the Opera>Phantom of the Opera Soundtrack (Disc 2)

This would leave w folder
Phantom of the Opera>Phantom of the Opera Soundtrack
with all the files with DISCNUMBER <> 2
and create a new folder
Phantom of the Opera>Phantom of the Opera Soundtrack (Disc 2)
Once you have moved all files with DISCNUMBER <> 1 to the new folders, rename the folder
Opera>Phantom of the Opera Soundtrack
to
Opera>Phantom of the Opera Soundtrack (Disc 1)

Or moe all files to new folders, risk it to get an empty old folder and then use a tool that detects empty folders which would then delete the folder
Opera>Phantom of the Opera Soundtrack

I still don't understand how renaming a file moves it to a different directory?

"Rename these files so that they are moved to a folder like
Phantom of the Opera>Phantom of the Opera Soundtrack (Disc 2)"

If you set a fully qualified name which includes a path component, then the file is moved to that (new) folder.

would be such a fully qualified name as it includes the drive, the path and the filename itself.

1 Like

If I may add to what has already been suggested by @ohrenkino that should already have you on the correct path.

From your first post, it is apparent that you already have metadata saved in these files that should be correct and complete, according to the actions you have shown in the first post. So rather than depending on your current file names, I would suggest you rename them using the updated tag info when moving them into the new disc-based format you want, including having the Album name followed by the disc number. This would eliminate the fifth action step (Format for _FILENAME) and changes the last action in your list to

Format value: "_FILENAME": A:\Music\Record\%artist%\%album%[$ifgreater(%totaldiscs%,1, '('Disc $left(%discnumber%,1)')',)]\$num(%track%,2) - %title%

  1. Note I have added a dash between the track and title for clarity, and have made sure all are 2-digits for proper sorting with the $num function. You can of course adjust this based on your personal preference.
  2. The $ifgreater function checks for any set where there is more than 1 disc and only set the folder with the (Disc x) name in those cases, including Disc 1.

Thanks both. That's exactly what I needed, it works perfectly when all files are in a single folder. So to confirm:

[#0]
T=5
F=TRACK
1=$num(%track%,2)

[#1]
T=4
F=DISCNUMBER
1=^(\\d+)/\\d+
2=$1
3=1

[#2]
T=5
F=ALBUM
1=$replace(%ALBUM%,'[','(',']',')') (Disc %discnumber%)

[#3]
T=5
F=TITLE
1=$replace(%TITLE%,'[','(',']',')')

[#4]
T=5
F=_FILENAME
1=$replace(%TRACK% %TITLE%,'[','(',']',')')

[#5]
T=4
F=TRACK
1=^(\\D+)/\\D+
2=$1
3=0

[#6]
T=5
F=TRACK
1=$num(%track%,2)

[#7]
T=5
F=_FILENAME
1=A:\\Music\\Record\\%artist%\\%album%[$ifgreater(%totaldiscs%,1, '('Disc $left(%discnumber%,1)')',)]\\$num(%track%,2) %title%

For anyone wanting something similar but where individual folders already exist, this works:

[#0]
T=5
F=TRACK
1=$num(%track%,2)

[#1]
T=4
F=DISCNUMBER
1=^(\\d+)/\\d+
2=$1
3=1

[#2]
T=5
F=ALBUM
1=$replace(%ALBUM%,'[','(',']',')') (Disc %discnumber%)

[#3]
T=5
F=TITLE
1=$replace(%TITLE%,'[','(',']',')')

[#4]
T=5
F=_FILENAME
1=$replace(%TRACK% %TITLE%,'[','(',']',')')

[#5]
T=4
F=TRACK
1=^(\\D+)/\\D+
2=$1
3=0

[#6]
T=5
F=TRACK
1=$num(%track%,2)

[#7]
T=5
F=_DIRECTORY
1=A:\\Music\\Record\\%artist%\\%album%


For future readers of this topic:

Some of the above Actions can not be undone.
For example:
If you format your DISCNUMBER with
^(\\d+)/\\d+
or
$num(%discnumber%,1)
you cut away your total number of discs.
From a DISCNUMBER with the content
3/5
you cut away /5

Other Actions could be undone, but not fully automated:
If you format your TRACK with
$num(%track%,2)
you cut away your total number of tracks.
From a TRACK with the content
07/12
you cut away /12
This Action exists twice in the above MTA, once in #0 and once in #6.
This is not necessary.

If you replace all square brackets [ ] with round brackets ( ) in ALBUM and TITLE, you can't distinguish them anymore.
Example ALBUM name
Hip-Hop [001], (Vol. 1)
becomes
Hip-Hop (001), (Vol. 1)

Example TITLE name
Piano Entry [part 1] (Remixed Version)
becomes
Piano Entry (part 1) (Remixed Version)

This can not be undone automatically.

There is a difference between the use of the regular expression \d (lowercase d) and \D (uppercase D).
In #1 \d searches for digits aka numbers.
In #5 \D searches for NON-digits. It is the opposite of \d

Please be careful if you use such predefined solutions and test it with previously backuped data only.
The result of the above Actions could have undesired consequences.

1 Like

That's extremely useful information, thank you!

Using the suggested format I provided for the filename with the directory and Disc number solution should not require you to have two separate actions. Since this already checks to see whether the disctotal is greater than one before adding this into the folder path, you can simply use one action and end up with the desired folder name results.

Just an observation:
This thread was also about albums with several discs. and if there are several discs, then this should be reflected with separate folders.
If the discnumber is now cut that it only shows 1, 2, 3 etc.
then all albums with just 1 disc could not be separated from albums with more discs as "1" always is "1" and not "1/1" or "1/2".
So I would expect, that all files of album no. 1 are left in the original folder while the others get moved to a subordinate folder labelled ... (Disc 2).
I don't know if this is really intended.

1 Like

This is a valid concern. I based my suggestion on having a TOTALDISCS type field available to work with. If this does not exist in the current data, then is should be dealt with prior to eliminating it from the DISCNUMBER. Although I am not sure why this is being done in the first place if it already exists there, as this is how it is properly stored for mp3 files using id3v2.3 tags.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.