Skip navigation.
Home
Now Shipping Version 8.0

File and Folder names with spaces

Hi,
I'm sure someone will know this.

I have folders and some files with names like "New Folder", i.e. containing spaces. In a terminal window, ls -l shows a list and the folder name is the same. However, "cd New Folder" gives an error, The file or folder does not exist. I assume that the name with the space is a display name, and the system is using something else. How do I find it?

Thank you for your help,

Don Jungk

try

cd "New Folder"

in the terminal type cd "N
and then press tab, it should complete it.
press tab twice and it will show you all the possible names that begin with N

Alan

Using Mepis...and proud of it.

Almost

Thanks,
It does list all the options.
It lists "New Folder" as "New\ Folder/"
but trying to use that in the next command I still get "no such file or directory"

Thank you for the idea.

spaces

Don,

Linux doesn't really like spaces in file or directory names, as a space is a delimiter. That is, spaces separate different names.

KDE, etc., handle these for us fairly transparently. To do it yourself in a console you need to use backslashes to enclose the spaces, so Linux 'knows' you don't mean them as delimiters:

New\ \Folder

You can create new folders in the console this way also:
mkdir New\ \Folder\ \2

will create 'New Folder 2'

You can enclose more than one space at a time if you want.

But this is why spaces are generally discouraged in file names, etc., because they cause complications though they are not completely disallowed.

Good luck. Smiling

Andy

That did it

Thank you very much.

Yes, I have avoided spaces for 15 years, even on Macintosh. I'm trying to deal with folders and files created by another program.

Thanks again,

don

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.