This is one of the methods I used when I had the same problem with my music library.
Running this code in the command line at the root directory of the folders you want to flatten:
for /r %f in (*) do @copy "%f" .
Turns a folder structure like this:
into something like this:
There are a few more advanced methods available here:
Alternatively, you might find that simply running that folder back through a robust music tagging software (Musicbrainz Picard - my personal favourite) that is set up correctly would fix your issue without having to delve into the command line.
Having tried both, I would probably go with this method. It may be a little more hands on, but it has less chance of something dramatic happening.
The settings in the picture below should work in restoring your albums to their correct positions. However, I do recommend setting the
Move files to this directory when saving: field to somewhere that isn't your default music directory. This will force it to create new folders for it to save into. From there, you can just follow the standard Picard Quick Start Guide.
Remember: Picard doesn't automatically save anything. Check the right-hand panel for gold albums, these are matched correctly. If you have any silver albums, these are incomplete or missing tracks.
Using a File Browser replacement program (such as Fileboss - again, a program I have used) that has a built in Flatten Folder function.