Results 1 to 7 of 7
-
09-25-2005, 04:28 AM #1AlexNGuestHow 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.
-
09-25-2005, 07:59 AM #2
- Member Since
- Feb 06, 2005
- Location
- Chicago
- Posts
- 1,543
- Specs:
- MacBook Pro Retina 13" • iPhone 7 • 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".
-
09-25-2005, 10:04 AM #3
- Member Since
- Feb 09, 2005
- Location
- DFW
- Posts
- 2,340
- Specs:
- 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.
-
09-25-2005, 10:20 AM #4
- Member Since
- Jul 22, 2003
- Location
- Hamilton College
- Posts
- 6,999
- Specs:
- 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 FolderDon't forget to use the new User Reputation System
-
09-25-2005, 10:58 AM #5
- Member Since
- Aug 17, 2005
- Posts
- 39
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/".
-
09-25-2005, 07:09 PM #6AlexNGuest
Originally Posted by haze
-
09-26-2005, 01:01 AM #7
- Member Since
- Mar 30, 2004
- Location
- USA
- Posts
- 4,744
- Specs:
- 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
-
Access the computer library folder rather than the user library folder with Terminal
By manytentacles in forum macOS - Operating SystemReplies: 1Last Post: 02-17-2012, 02:30 PM -
Why Terminal highlights folders yellow?
By peen in forum macOS - Development and DarwinReplies: 3Last Post: 08-11-2011, 03:15 PM -
Wrong access rights on folders created in the Shared folder.
By RvanK in forum Internet, Networking, and WirelessReplies: 0Last Post: 11-15-2010, 04:31 PM -
Give folder access rights to files in folder
By shabby in forum macOS - Operating SystemReplies: 9Last Post: 05-25-2010, 04:59 PM -
Folders invisible in Terminal
By oliq in forum macOS - Operating SystemReplies: 0Last Post: 06-02-2007, 04:37 AM