I used to have a program back in os 10.7 days that i think was called RenameIt or somethinng like that and would rename folders and files. I know that isnt super helpful but know there were multiple free applications 5 or so years ago that would do this seamlessly. edit it was renamer4mac https://renamer.com
You don't say if you are Mac or Windows - but on the Mac I'm a huge fan of Renamer: https://renamer.com/
I'm sure there is something equivalent for Windows. The good news for music and photo files - there is often extra metadata embedded in them. And if that data is at least somewhat complete, you can use it to easily rebuild your file structure. I think Renamer can even use folder structure to update tags in files, essentially going in reverse. If not Renamer there is at least one utility out there that will.
That's probably how I would approach it. May not be perfect but should get you the majority of the way there. And for the files that are problematic - fix the tags in them :)
Looks like you can
​
>Groups and backreferences
>
>You can use parentheses (…) to group expressions, and then insert the matched expression using a dollar sign $followed by the number of the group.
>
>Example: Search for “(Renamer [0-9]*)(Mac)”, the text is “I frequently use Renamer 6 on my Mac”:
>
>$1 = Renamer 6 = 1st group: “(Renamer [0-9]*)” $2 = Mac = 2nd group: “(Mac)”
​
Source: https://renamer.com/help/English.lproj/regular_expressions.html