Hi I'm trying to organise my data and currently I have a structure of my movies like this:
ls /home/adam/movies
Star.trek1
-CD1/Star.trek1-cd1.avi
-CD2/Star.trek1-cd2.avi
Star.trek2
-CD1/Star.trek2-cd1.avi
-CD2/Star.trek2-cd2.avi
Star.trek3
-CD1/Star.trek3-cd1.avi
-CD2/Star.trek3-cd2.avi
etc..
This has worked really well but now I'm starting to use XBMC and it likes to have all files of a movie in the same dir.
-Star.trek1
Star.trek1-cd1.avi
Star.trek1-cd2.avi
So I'm looking for a script that does this automatically:
./movefiles.sh /home/adam/movies/
This would go over all my movies and look for CD1 and CD2 directories and when it finds them, move all files in those directories one dir up to the movies "base" dir. If the movies doesnt have a CD1/CD2 dir, nothing should happen.
Also some of my movies are categories in subdirectories, like all star trek movies could all be inside a directory: /home/adam/movies/startrek/
So recursive search from base dir (./movefiles.sh /home/adam/movies/) would be great!

Maybe this is complicated, I'm new to scripting and programming in general but would love some help with this!! It would save me loads of time and I think it might help others aswell, as media centers only seem to grow and grow.
Thanks again, and if you have any questions please post here and I'll come back to you.