There is problem with the fnmatch() function, because [ and ] are valid filename characters and they screw up the matching... You cant say something like \[ to match the exact character.