Accessing files/folders with spaces | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Accessing files/folders with spaces

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-11-2003
a25khan's Avatar
a25khan a25khan is offline
Registered User
 
Join Date: Dec 2003
Last Activity: 2 March 2004, 11:56 PM EST
Location: My home :D
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Error Accessing files/folders with spaces

Hi there,
our unix and windows are related. i.e. if i save a file while being on windows my unix profile would contain the same file, at the same location. so i can access all my files through unix prompt. but if i save a file/folder being on windows account and put spaces between the name of the folder or file then i am unable to access it through unix. i use SSH. for example under my home directory i have a folder My Name. when i do cd My Name, i get an error sayin no such file or directory! this is not a problem though since SSH allows me to upload this folder from my school directory to my desktop(like we do in kazaa). my question is, can we access such directories or files which contain spaces in their names?
Thanks
Sponsored Links
    #2  
Old 12-11-2003
RTM's Avatar
RTM RTM is offline Forum Advisor  
Registered User
 
Join Date: Apr 2002
Last Activity: 17 October 2014, 8:46 PM EDT
Location: On my motorcycle
Posts: 3,093
Thanks: 1
Thanked 32 Times in 9 Posts
By quoting the directory, you could change directory into it.

$ cd "My Name"

If it's the only directory/file that starts with My

$ cd My*

Or by using the following on each space in the name

$ cd My\ Name
Sponsored Links
    #3  
Old 12-11-2003
a25khan's Avatar
a25khan a25khan is offline
Registered User
 
Join Date: Dec 2003
Last Activity: 2 March 2004, 11:56 PM EST
Location: My home :D
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Computer Got it!!!!

Hi there,
actually i jus figured it out myself! when i was using the tab command to list all the prompt commands, i found the dir command. when i pressed dir it showed me the directory path in a different manner for files/folders. they files that contained spaces had a "\" behind the space! so then i realised that what if i do cd My\ Name????? i tried this n guess what it worked
seeems like i am gettin sumwhere!
Cheers
    #4  
Old 12-11-2003
a25khan's Avatar
a25khan a25khan is offline
Registered User
 
Join Date: Dec 2003
Last Activity: 2 March 2004, 11:56 PM EST
Location: My home :D
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Computer

RTM,
yeah i jus figured it out! thanks for your answer as well
Cheers!
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Searching for folders/parent folders not files. Aussiemick UNIX for Dummies Questions & Answers 2 06-23-2011 11:56 PM
Compare 2 folders to find several missing files among huge amounts of files. jiapei100 Shell Programming and Scripting 1 05-10-2010 04:00 PM
Script to find folders with spaces and end of files and directories treds Shell Programming and Scripting 8 07-29-2009 11:56 AM
Accessing files with perl chriss_58 Shell Programming and Scripting 2 05-28-2008 09:33 PM
Accessing Files on another drive PravusMentis UNIX for Dummies Questions & Answers 2 07-25-2001 01:37 PM



All times are GMT -4. The time now is 01:38 AM.