I think just appending Hair or Skin should be sufficient. I'm thinking in that case, it'd be best to instead read through the file list once, cache it, and then do more complicated analysis on the name to capture out attributes. BrownHair BrownSkin = specific attributes, Brown without a qualifier however is treated as hair. As long as everything is consistent, I'm sure I can make something to match it. Biggest thing is to make sure the body matches the portrait path.
I also noticed there's an issue with Elf vs DarkElf. where Elf will match all DarkElf currently. Also wondering how best to handle DarkElf vs. Drow. Visually I'm not aware of any difference between the two? Thinking it makes sense for DarkElf and Drow to accept protraits named for either. Or should that be left up to the portrait pack to name the file with both?