LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   are double quotation marks allowed in filenames? (https://www.linuxquestions.org/questions/linux-general-1/are-double-quotation-marks-allowed-in-filenames-808962/)

newbiesforever 05-19-2010 07:24 PM

are double quotation marks allowed in filenames?
 
Never mind; I solved my own problem. I was asking:
Quote:

I tried to move a file from my desktop to another folder; moving it was not allowed, for some reason. Neither was opening it and saving a new copy in the target folder. Would that be because the filename contains double (") quotation marks? Are they not allowed? The filename is Edit of Bob's "Lady Liberty" Article.doc. [Filename not enclosed in quotation marks here, to avoid confusion.]
I just changed the double quotation marks to single quotation marks; that solved everything.

AlucardZero 05-19-2010 07:33 PM

Yes they are. But you then have to escape the quotes.
Code:

ls Edit of Bob's \"Lady Liberty\" Article.doc

catkin 05-20-2010 06:00 AM

Quote:

Originally Posted by AlucardZero (Post 3974790)
Yes they are. But you then have to escape the quotes.
Code:

ls Edit of Bob's \"Lady Liberty\" Article.doc

I think that's a typo for
Code:

ls "Edit of Bob's \"Lady Liberty\" Article.doc"
Alternatively (and this is how bash command completion will do it for you if you type ls E and then press the tab, twice if E* is not unique):
Code:

ls Edit\ of\ Bob\'s\ \"Lady\ Liberty\"\ Article.doc
Having both single and double quotes in the name makes it harder. Without the single quote you could single quote the name:
Code:

ls 'Edit of Bobs "Lady Liberty" Article.doc'
Or you can double quote the part with the single quote and single quote the part with the double quotes:
Code:

ls "Edit of Bob'"'s "Lady Liberty" Article.doc'
A file name may contain any character except / and NUL (ASCII 0).


All times are GMT -5. The time now is 09:33 AM.