Replace bad characters such as slashes from directory entries, preventing I/O errors