Handling file paths containing certain characters - urbanware-org/salomon GitHub Wiki
Handling file paths containing certain characters
Table of contents
General information
Paths which contain spaces must either be enclosed with (single or double) quotes or given with escaped whitespaces.
Escaping also applies to special characters such as quotes or backslashes inside the file name. Due to the fact, that backslashes are escape characters, it is most unlikely that a file path contains one.
Below you can find a few examples of escaped characters.
Escaping certain characters
Each of those characters must be escaped using a backslash (\
) which also applies to consecutive ones.
Whitespaces
File path | Escaped |
---|---|
/home/johndoe/server mails.log |
/home/johndoe/server\ mails.log |
/home/johndoe/server user logins.log |
/home/johndoe/server\ user\ logins.log |
/home/johndoe/server user logins.log |
/home/johndoe/server\ \ \ user\ logins.log |
Quotation marks
File path | Escaped |
---|---|
/home/johndoe/output of 'tail'.log |
/home/johndoe/output\ of\ \'tail\'.log |
/home/johndoe/output of "tail".log |
/home/johndoe/output\ of\ \"tail\".log |
Backslashes
Most unlikely, but just in case:
File path | Escaped |
---|---|
/home/johndoe/foo\bar.log |
/home/johndoe/foo\\bar.log |