This question is the same as http://askubuntu.com/questions/47155/reorder-files-inside-folder:
I have about 30K songs in mp3. I already organized/tagged them with Musicbrainz Picard. But Picard made an excess of folders and subfolders inside each other because of the tags. What I need now is a script to do the following inside the main music folder:
To read each subfolder and move all the mp3 files inside the subfolder's folders to the main subfolder. For example:
Music - Offspring - Album 1 - 20 songs Album 2 - 30 songs Album 3 - 5 Songs Folder 1 - 2 Songs Folder 2 - 3 Songs Journey - Song Pack 1 - 2 Songs Packy 1 - 15 Songs Packy 2 - 20 Songs Packy 3 - 7 Songs Album 2 - 20 songs Whatever 3 - 10 Songs
After script they would be like this:
Music - Offspring - All Songs inside THIS folder. Not inside subfolders of Offspring. Journey - All Songs inside THIS folder. Not inside subfolders of Journey.
And so on..
So all the music for each subfolder of each music group should not have any more subfolders and all songs inside their respective sub-subfolders should be moved to the main sub-folder of the music group.
So when I check Music and I see the Bee Gees then I KNOW that all the songs are right there and not inside some subfolder of Bee Gees.
NOTE - In some cases there are more than 20 recursive sub-folders. An example is: Music/Lady Gaga/1/Album/Lady Gaga/2/2/2/1/1/1/1/3/3Album 2/Lady Gaga/1/1/1/SONG.mp3. In this case i want the son inside Music/Lady Gaga and eliminate the rest of the folders. Please do not take into account that the files are mp3. Just think of them as normal text files or something since what I want can also be applied to group of files inside several folders.