cd-ing to a directory with a lot of spaces--mac terminal
Matthew Martinez
I want to cd to a path with spaces in the folder names, but it doesn't work. I want to navigate straight to a directory which has multiple levels of directories on the way, each with a lot of spaces. Please look at the following example:
Say I want to navigate to:
./Folder/Animal Pictures/Dog Pictures/Golden Retriever Pictures/Golden Retrievers Playing Ball
I tried:
cd ./Folder/"Animal Pictures"/"Dog Pictures"/"Golden Retriever Pictures"/"Golden Retrievers Playing Ball"But I got the error:
cd: too many argumentsWhat should I do?
41 Answer
You use a backslash to indicate the next character is part of the name & not a split where a new instruction starts.
cd ./Folder/Animal\ Pictures/Dog\ Pictures/Golden\ Retriever Pictures/Golden\ Retrievers\ Playing\ BallYou can test this - or even use it to be much quicker than typing, by just typing cd then dragging the folder itself from Finder to Terminal. It will format it correctly for you.