Sprintup
Sprintup

Reputation: 93

Can't cd to directory which has spaces in the name

I am trying to make my first commit in git from the terminal, however the file that I am trying to commit apparently does not exist... but it does. When I run ls I can see it in the listed documents. It is a folder named Portland Code School Example in the folder /Users/SP_Desktop1/dropbox/coding. It has a simple index.html webpage inside.

When I try to navigate inside the folder (after verifying that I'm in the coding file using pwd) by using cd Portland Code School Example it returns -bash: cd: portland: No such file or directory

I am able to cd into other files from the coding file, but for some reason I can't enter the Portland Code School Example folder. I figure that once I am inside I can stage the index.html file to commit it to github.

Thanks for any help.

Upvotes: 0

Views: 8012

Answers (2)

Hari Rao
Hari Rao

Reputation: 3240

Space is the problem. It is always good to use underscores (Portland_Code_School_Example) when creating directories but for this you can use tab key

eg Portland tabkey

Upvotes: 0

Matt Ball
Matt Ball

Reputation: 359776

The problem is that there are spaces in the name of the directory to which you're trying to navigate. Escape spaces with \ when cding:

 > cd Portland\ Code\ School\ Example

Or wrap the directory name in quotes:

 > cd "Portland Code School Example"

Upvotes: 8

Related Questions