In some common operating systems, including Windows, both the forward slash and backslash are reserved characters that cannot be used in filenames.

Yet sometimes one has a good reason to want to include such characters in a filename. What I currently do is replace all forward slashes with the string !fslash! and all backslashes with the string !bslash! when I want to indicate one of those characters in a filename.

Is there a better hack than what I am already doing?


If you do not need it to look like a slash, you can use a different substitution character.

If you want the character to actually look like a slash, you can use the division slash, unicode U+2215.

The best option for the backslash alternative is probably the double backslash character, unicode U+244A.

  • 2
    Just keep that this approach will likely confuse any other use trying to find a folder called like the first part of the file. Apr 23 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.