remove unnecessary characters in the path