The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Hardware > Filesystems, Disks and Memory
.
google unix.com



Filesystems, Disks and Memory Discuss NAS, SAN, RAID, Robotic Libraries, backup devices, RAM, DRAM, SCSI, IDE, EIDE topics here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
removing directory in an input file chrysSty UNIX for Dummies Questions & Answers 2 06-05-2008 12:12 AM
Problem Removing a Directory !!! gauravsachan UNIX Desktop for Dummies Questions & Answers 1 03-15-2007 01:53 AM
Removing the oldest file in a directory pavan_movva Shell Programming and Scripting 2 10-10-2006 12:38 PM
Removing files automatically from a directory after 30 days. justinb_155 Shell Programming and Scripting 7 06-24-2005 03:07 PM
removing a directory da_curtain UNIX for Dummies Questions & Answers 7 12-23-2003 01:55 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-08-2008
npatel npatel is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 1
Question Removing a file from a directory

How do you remove a file named '-'? ('rm' does not work)
  #2 (permalink)  
Old 01-08-2008
santosh.mane santosh.mane is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 3
Thumbs up removal of file "-"

Try the below command :

find . -type f -name "-" -exec rm {} \;

I have tried and it worked.
  #3 (permalink)  
Old 01-08-2008
dennis.jacob dennis.jacob is offline Forum Advisor  
dj - the student
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 610
Try this

ls -i -

find . -inum <<<inodenumber>>> -exec rm -i {} \;
  #4 (permalink)  
Old 01-08-2008
Tytalus's Avatar
Tytalus Tytalus is offline Forum Advisor  
echo {1..9}^2\;|bc
  
 

Join Date: Jun 2003
Location: Scotland
Posts: 431
or more simply:

rm -- -

will work.

the double hyphen is useful for several commands; it basically informs that there are no more switches, but to treat the rest of input as args
  #5 (permalink)  
Old 05-02-2008
hasanatizaz hasanatizaz is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 12
i m assuming, you are trying to remove '-'
rm -rf "'-'"
and if you are trying to remove -
then
rm -rf "-"

Last edited by hasanatizaz; 05-03-2008 at 03:34 AM..
  #6 (permalink)  
Old 05-22-2008
incredible incredible is offline Forum Advisor  
Registered User
  
 

Join Date: May 2008
Location: s'pore
Posts: 2,122
anyone knows wat wil happen if you accidentally do "rm ~" ??
anyone here has encountered disaster?!!
Closed Thread

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0