Remove illegal character from pathname