LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-07-2011, 03:22 PM   #1
d4v3
LQ Newbie
 
Registered: Apr 2011
Posts: 12

Rep: Reputation: 0
rename a directory filename with " \ " character


hi

in error the directory filename has " \ " character and i ca not open it, somebody can help me either to rename de directory or delete it, i tried to delete i and rename, but it is no possible


itcam /itm/media =>rm \itm\media\
>
rm: itmmedia: A file or directory in the path name does not exist.
itcam /itm/media =>rm -i \itm\media\
> s
rm: itmmedias: A file or directory in the path name does not exist.
itcam /itm/media =>

thanks in advance
 
Old 06-07-2011, 03:23 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
just escape the character with a "\" or better still, use bash tab completion and it'll do it all for you...
 
Old 06-07-2011, 03:57 PM   #3
d4v3
LQ Newbie
 
Registered: Apr 2011
Posts: 12

Original Poster
Rep: Reputation: 0
Exclamation reply

Quote:
Originally Posted by acid_kewpie View Post
just escape the character with a "\" or better still, use bash tab completion and it'll do it all for you...

im sorry i forgot the question is about UNIX,also tab does not function on unix systems, i red that is not easy to work with filenames with special characters such as " \ ", any idea to solve this ?
 
Old 06-07-2011, 04:05 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
well don't just stick to what you read. a \ should escape special characters just fine. Other than that, try enclosing it in single quotes.
 
Old 06-07-2011, 04:59 PM   #5
d4v3
LQ Newbie
 
Registered: Apr 2011
Posts: 12

Original Poster
Rep: Reputation: 0
reply

i don't understand ...what should i type in order to change o remove the directory which name is \itm\media\ by error ?

thanks
 
Old 06-07-2011, 05:39 PM   #6
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,447

Rep: Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204
Code:
rmdir \\itm\\media
Evo2.

---------- Post added 2011-06-08 at 07:39 ----------

Code:
rmdir \\itm\\media
Evo2.
 
Old 06-07-2011, 05:59 PM   #7
d4v3
LQ Newbie
 
Registered: Apr 2011
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by evo2 View Post
Code:
rmdir \\itm\\media
Evo2.

---------- Post added 2011-06-08 at 07:39 ----------

Code:
rmdir \\itm\\media
Evo2.
thanks Evo2, i could change the file name to a *.tar file but when i tried to tar xvf *.tar command was an error, whatever thanks for the post, i just want to know how is it the double \ works...
 
Old 06-07-2011, 06:11 PM   #8
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
Quote:
Originally Posted by d4v3 View Post
i could change the file name to a *.tar file but when i tried to tar xvf *.tar command was an error, whatever thanks for the post, i just want to know how is it the double \ works...
Previous posts explained it.

"\" escapes special characters. This makes it special so you need to escape it.
 
Old 06-07-2011, 06:45 PM   #9
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,447

Rep: Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204
Quote:
Originally Posted by MTK358 View Post
Previous posts explained it.

"\" escapes special characters. This makes it special so you need to escape it.
Problem is, this assumes that the OP knew what "escape" means in this context.

Evo2.
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] "tail -n 1 filename" error while "head -n 1 filename" is ok? type8code0 Linux - Newbie 3 03-21-2011 06:10 AM
[SOLVED] move all ".txt" files, adding parent directory to filename mostofmonty Linux - Newbie 9 09-15-2009 08:39 AM
/bin/cp cannot stat "filename" no such file name or directory fcfury Linux - Newbie 2 07-01-2009 09:21 AM
rename "/media/My Book" directory dourk Linux - Hardware 1 04-24-2008 09:17 AM
"tar - filename reads nul character" when compiling gtk-gnutella 0.96.3 HunterLoftis Linux - Laptop and Netbook 2 03-30-2007 07:58 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration