advertisement

Article:
  Learning the Mac OS X Terminal: Part 1
Subject:   its easy
Date:   2003-03-12 09:26:20
From:   chris_stone
Response to: its easy

Well, you're halfway there...:-)


First, what you were attempting to cd to was a directory called "Pictures Folder" at the very top of your directory tree, i.e., "root". You were specifying this by beginning the pathname with a "/", which indicates the absolute pathname.


However, if you are already in your home directory and want to go down a level to, say, Pictures, then you would use a relative pathname, that is one that does not begin with the "/".


There is still a second issue, however, which is resulting in your "cd: Too many arguments" error. Remember that the shell sees the space character as the separator of arguments. So when you have a pathname containing a space, as in your case, cd breaks that string of text at the space and tries to handle the two strings as separate arguments instead of as a single one. cd won't work with multiple arguments, however, so you get the error.


The fix? Well, what you need to do is indicate that the space is not an argument separator, but the literal space character. The two ways to indicate that, or "escape" that character, are by either preceding it with a backslash, or enclosing the argument in quotes.


For example, either of these two commands would do what you need, with your working directory being your home directory:


cd Pictures/General\ Pictures
cd "Pictures/General Pictures"


BTW, a cool Terminal trick that can save some time is to just drag the actual folder icon of the directory in question from the Finder desktop right into the Terminal window (after you've typed cd and space, for example), and the fully escaped pathname will get entered right into the command line for you.


Hope that helps!



--Chris


1 to 1 of 1
  1. its easy - and thanks
    2003-03-13 05:20:15  macmartin [View]

1 to 1 of 1