I have a directory of music that has album folders as well as individual songs on each level. How can I traverse all of these files that also are encoded in different formats(mp3, wav etc)? In addition is there a way I can rename them to a format that is more consistent to my liking using regular expressions?
Thanks
os.walk
to go over files in the directory and its sub-directories, recursivelyos.rename
to rename themThe encoding of the files pays no role here, I think. You can, of course, detect their extension (use
os.path.splitext
for that) and do something based on it, but as long as you just need to rename files (i.e. manipulate their names), contents hardly matter.