Home » Questions » Computers [ Ask a new question ]

How to go to a directory that has spaces in its name?

How to go to a directory that has spaces in its name?

I am beginner to the Mac command line interface.

Asked by: Guest | Views: 283
Total answers/comments: 2
bert [Entry]

"cd 'how are you'

Or,

cd how\ are\ you"
bert [Entry]

"If you simply want an AppleScript to change it's current working directory, it isn't possible for the entire script as do shell script ""uses a new shell process, so state such as changes to variables and the working directory is not saved from one to the next."" (Source)

do shell script 'cd /PATH/TO/DIRECTORY/; more commands here'

If you want to use AppleScript to open up and change to the directory in Terminal:

tell application ""Terminal""
activate
do script ""cd /PATH/TO/DIRECTORY""
end tell"