I'm learning python and I'm trying to write something that's actually useful to me instead of just going through a bunch of exercises in a book. The idea is instead of using python to find and move various files/folders that I would just use python to issue commands in the terminal to get the job done.
So what I'm trying to do is write a script that will look in the downloads folder (and sub directories) and check for certain file types and move the files to the appropriate folder. (.mp3 -> music, .doc -> documents, etc). I've written a fairly lengthy script that does just this but the problem is that it moves the files when instead I want it to move the folders containing the files.
For example if I download an album I don't want to move all the individual mp3's to the music folder I want to move the folder containing all the songs. Similarly if I download a TV show I don't want it to move all the episodes to videos, but rather move the folder containing the episodes to the right folder.
I can take care of the python stuff myself so what I'm looking for is a terminal command that will look in the downloads folder and any sub directories, check for a file type (e.g .mp3) and then move the folder that contains the files rather than the files themselves. I can't for the life of me figure out how to do this so just thought I'd try asking here for help. Much appreciated!