Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 28th, 2011, 10:30 PM
chrisjacob.us chrisjacob.us is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2009
Location: United States
Posts: 116 chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 35835 Folding Title: Starter FolderFolding Points: 35835 Folding Title: Starter Folder
Time spent in forums: 3 Days 17 h 40 m 32 sec
Reputation Power: 134
Deleting file with back slash in name

I somehow created a file called "\ --directory" in the / directory of my server. I created it trying to create a tar file from the command line...I'm not sure what I had typed exactly since I did it a few hours ago.

I can't figure out how to delete it, no matter what I try it says "no such file or directory".


Reply With Quote
  #2  
Old November 29th, 2011, 04:01 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 41 m
Reputation Power: 1485
When trying to deleet files with bizarre names, containing special characters I tend to tread carefully and use the ls command first to find out just what the shell will accept. Once I can list the file I will change the ls to rm. Anyway, try:

Code:
rm "\\ \-\-directory"
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc

Reply With Quote
  #3  
Old November 29th, 2011, 05:01 PM
chrisjacob.us chrisjacob.us is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2009
Location: United States
Posts: 116 chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 35835 Folding Title: Starter FolderFolding Points: 35835 Folding Title: Starter Folder
Time spent in forums: 3 Days 17 h 40 m 32 sec
Reputation Power: 134
That doesn't work either. It simple gives me
Code:
rm: cannot lstat `\\ \\-\\-directory': No such file or directory

Reply With Quote
  #4  
Old November 29th, 2011, 06:18 PM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 41 m
Reputation Power: 1485
I hate trying stuff like this ...! As I said, messing about with an ls command can work wonders ... sometimes you need to 'quote' spaces (such as (\ ), sometimes having them in quotes (" ") is enough.
What do:
Code:
ls "\\ *"
ls "\\\ *"
ls "*directory"

return?

Reply With Quote
  #5  
Old November 29th, 2011, 06:58 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,237 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 14 h 47 m 12 sec
Reputation Power: 4445
If the file is named
Quote:
\ --directory

then use this to remove it
Quote:
rm "\\ --directory"

Also, if you have mc installed on your linux box you can let mc do the hard work of parsing the filename, you just have to arrow the selection bar over the offending file and delete it.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #6  
Old November 29th, 2011, 10:30 PM
chrisjacob.us chrisjacob.us is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2009
Location: United States
Posts: 116 chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)chrisjacob.us User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 35835 Folding Title: Starter FolderFolding Points: 35835 Folding Title: Starter Folder
Time spent in forums: 3 Days 17 h 40 m 32 sec
Reputation Power: 134
I went the MC route (I've never heard of this, so thanks!).

Even
Code:
rm "\\ --directory"
didn't work. But it's fixed now, again many thanks guys.

Reply With Quote
  #7  
Old November 29th, 2011, 10:55 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,237 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 14 h 47 m 12 sec
Reputation Power: 4445
I find mc indispensable for command-line work. It's the first thing I add on a new linux system.

You might have had a non-printing character in your filename. I once had a filename that had embedded a couple ctrl-H (backspace) that hid the complete filename. The cursor backed up and overwrote a couple characters that you couldn't see.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Deleting file with back slash in name

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap