Taming Your Music Collection: File Structure

Data & Observations
     For my test data, it worked exactly as intended. The files are saved in their new directory structure according to the pattern I like and I am now able to manipulate all of my mp3 collection to follow the same exact pattern (provided each file has correct id3 info—future tutorials will handle missing id3 info and special cases).

     One thing to consider, some id3 info contains special characters that are illegal for file names and directories. We can create a simple function to address this to ensure our file names are always legitimate.
def filepathEncode(filename):
    illegal = ["/", "\\", "?", "%", "*", ":", "|", "\"", "<", ">", "!"]

    for i in illegal:
        filename = filename.replace(i, "")

    return filename