In foobar you could use Masstagger component with 'Guess values from filename' ...
(This does the same as the right-click tracks > Properties > Tools button > Automatically Fill Values - except Masstagger lets you save it as a preset to run quickly)
using the metatogger, I rename the tags in the track files from the folder names. I do not know how to configure it in the case when you need to cut off the part from the beginning and the tail
%album artist%\%date% - %album%\%discnumber%\
How to replace
CD1 - Album
CD2 - Bonus
to a simple number without "CD" and ending with " - Album"
If using Masstagger, select all album tracks > right-click > Tagging > Manage Scripts
Clear button (to remove previous)
Add > 'Guess values from filename' -
%album artist%\%date% - %album%\CD%discnumber% - %discsubtitle%\%tracknumber% %title%
^ The DISCNUMBER field should only contain a number, therefore the above would move "Album" or "Bonus" text to DISCSUBTITLE field. (Note: You may need to fix the %tracknumber% %title% part to match your filenames, if they have a dot . or - for example, make the pattern match)
Check the preview to see the result before running the script. (You can also save it as a preset to run from context menu, and then make it a toolbar button / keyboard shortcut)
ARTISTWhat are you trying to rename here? If you mean tags, really the ALBUM tag should not contain that information - it should only have the album name.
--YEAR - ALBUM
As an option, I would like to see your design-add the name of the third nesting folder to the name of the second folder and enclose it in parentheses
Name Album (CD2 - Bonus)
Instead, just use title formatting in your playlist grouping to show that information using the various tags. For example make a playlist grouping like this -
%album artist% - %album%[ '('CD%discnumber%[ - %discsubtitle%]')']