LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-16-2006, 07:41 PM   #1
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Rep: Reputation: 15
How do I cd into a directory with a leading backslash?


Say I'm here:

/home/me/

ls -l:

drwxrwxrwx 2 me me 4.0K Apr 10 22:57 \folder/

how do I cd into \folder/ ?

cg
 
Old 07-16-2006, 07:49 PM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
cd "\folder"
 
Old 07-16-2006, 08:00 PM   #3
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Original Poster
Rep: Reputation: 15
Afraid not, I get:

-bash: cd: \folder: No such file or directory

cd
 
Old 07-16-2006, 08:07 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
tried cd \\folder?
 
Old 07-16-2006, 08:11 PM   #5
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Original Poster
Rep: Reputation: 15
Yep, the same error message!

cg
 
Old 07-16-2006, 08:13 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Are you sure there are no hidden characters or anything in the directory name, just a backslash? \\folder works for me.
 
Old 07-16-2006, 10:48 PM   #7
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
You could start the name and use the tab key to complete it.
For example: cd \\fold<tab>
 
Old 07-16-2006, 10:55 PM   #8
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
I use zsh as opposed to bash but 'cd \\dir' works fine here. Maybe this, it's worked for me before when typos lead to weird directory names.
Code:
cd -- \\dir
 
Old 07-17-2006, 04:18 AM   #9
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by homey
You could start the name and use the tab key to complete it.
For example: cd \\fold<tab>
Nope that didn't work.

cg
 
Old 07-17-2006, 04:19 AM   #10
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by cs-cam
I use zsh as opposed to bash but 'cd \\dir' works fine here. Maybe this, it's worked for me before when typos lead to weird directory names.
Code:
cd -- \\dir
...or that.

cg
 
Old 07-17-2006, 04:20 AM   #11
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Matir
Are you sure there are no hidden characters or anything in the directory name, just a backslash? \\folder works for me.
It could well be, how do I go about checking? Is there not an elaborate work around similar to:

ls -l | grep me | awk '{print $9)' | xargs cd

?

cg
 
Old 07-17-2006, 09:08 AM   #12
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
To check, you can do: 'ls -Q'

This will show any control characters in an octal-encoded form.

Let us know what this shows.
 
Old 07-17-2006, 09:51 AM   #13
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Original Poster
Rep: Reputation: 15
Thanks, but it reports all is well:

Code:
"\240"/
was the output the folder is called: \240

This is driving me nuts! I can neither delete or cd into this directory...

cg

Last edited by closet geek; 07-17-2006 at 09:52 AM.
 
Old 07-17-2006, 09:59 AM   #14
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Original Poster
Rep: Reputation: 15
Maybe this helps, when I type cd then hit tab it brings up a list of choices, one of them is:

Code:
 /
There is a deliberate space there before the / as that's what the output is. I've tried cd " /" but it doesn't work.

cg
 
Old 07-17-2006, 10:09 AM   #15
closet geek
Member
 
Registered: Apr 2003
Location: England
Posts: 146

Original Poster
Rep: Reputation: 15
Ok using vim (ahhh vim) to view the directory structure it labels the directory as:

Code:
<a0>/
surely that'll help someone figure this out.

cg

Last edited by closet geek; 07-17-2006 at 11:22 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Deleting a Backslash! Am i an idiot? farmerjoe Programming 3 03-21-2005 11:03 AM
backslash input in script esasse Linux - Newbie 6 02-17-2005 06:55 AM
Trailing Backslash problem duerra Linux - Newbie 6 01-28-2004 12:58 PM
Backslash in URL Cynthia Blue Linux - Newbie 17 08-18-2003 07:36 AM
Apache: Need backslash to indicate directory? kipbenson4 Linux - Software 2 08-12-2003 09:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration