Results 1 to 7 of 7
  1. #1
    How do I access folders that contain space in Terminal. (ie. My Folder)
    How do I access folders that contain space in Terminal. (ie. My Folder)

    "cd My Folder" doesn't work.

  2. #2

    caribiner23's Avatar
    Member Since
    Feb 06, 2005
    MacBook Pro Retina 13" • iPhone 6 • iPad Air • and many iPods
    You access the directory based on its path.

    If you have a directory called "Music" in your home directory, you get there by typing "cd Music" if you're already in your home directory (which is where Terminal puts you by default)

    You can also use "cd ~/Music" if you're somewhere other than your home directory.

    If you're trying to do all this as the root user, you need to use the absolute path, e.g "cd /Users/username/Music"

    If your issue is that you're trying to access a directory that has a space in its name, you tell the UNIX shell to avoid interpreting the space by using a backslash before the offending character. In your example, you would type "cd My\ Folder" (note the backslash before the space before the word "Folder".

  3. #3

    fearlessfreap24's Avatar
    Member Since
    Feb 09, 2005
    Near San Diego, CA
    MacBook Pro 13" | MacBook Pro 13" | Mac Mini 2GHz C2D
    i have used:

    cd "My Folder"

    and it worked. You can give that a try.

  4. #4

    Member Since
    Jul 22, 2003
    Hamilton College
    20" iMac C2D 2.16ghz, 13" MacBook 2.0ghz, 60gb iPod vid, 1gb nano
    The initial directory is your home directory so unless the folder is in their you need to specify the path more

    cd /Desktop/My Folder
    Don't forget to use the new User Reputation System

  5. #5

    Member Since
    Aug 17, 2005
    Always remember that the tab key is your friend and will autocomplete for you. e.g. typing "cd My" + hitting tab will complete the line for you as "cd My\ Folder/".

  6. #6
    Quote Originally Posted by haze
    "cd My\ Folder/".
    Oh that's it. "cd My\ Folder" works. Myabe it the escape sequence. got it. Thanks.

  7. #7

    Member Since
    Mar 30, 2004
    12" Apple PowerBook G4 (1.5GHz)
    Don't forget the easy way...
    cd<space>+drag the folder icon from the Finder into the Terminal window.

    Much better than trying to type "cd ~/folder/subfolder/subsubfolder/subsubsubfolder/sub...." without making a typo.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 02-17-2012, 03:30 PM
  2. Why Terminal highlights folders yellow?
    By peen in forum OS X - Development and Darwin
    Replies: 3
    Last Post: 08-11-2011, 04:15 PM
  3. Wrong access rights on folders created in the Shared folder.
    By RvanK in forum Internet, Networking, and Wireless
    Replies: 0
    Last Post: 11-15-2010, 05:31 PM
  4. Give folder access rights to files in folder
    By shabby in forum OS X - Operating System
    Replies: 9
    Last Post: 05-25-2010, 05:59 PM
  5. Folders invisible in Terminal
    By oliq in forum OS X - Operating System
    Replies: 0
    Last Post: 06-02-2007, 05:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts