The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Removing Files jazz8146 UNIX for Dummies Questions & Answers 4 01-29-2008 06:50 AM
removing old files except configuration files and folders jamcalicut Shell Programming and Scripting 1 11-09-2007 12:34 PM
Removing files LiquidChild UNIX for Advanced & Expert Users 2 06-22-2007 06:39 AM
removing files luft UNIX for Dummies Questions & Answers 8 03-21-2007 08:53 AM
Removing Files Dastard SUN Solaris 1 03-13-2007 05:13 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-16-2001
Registered User
 

Join Date: Jul 2001
Location: Papua New Guinea
Posts: 2
Removing Files

I am trying to remove a file so that I can delete a directory. Unfortuantely the file looks like this --------.--- and the system is not allowing me to remove the file. System message is
rm: Error: Illegal option -- -
usage: rm [-fiRr] file...
I have tried rm * and rm *.* to no avail.
Any Suggestions?
Forum Sponsor
  #2 (permalink)  
Old 07-16-2001
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
Try giving the entire path name... For example, to remove --------.--- in the /var/tmp/old directory, you would type:

rm /var/tmp/old/--------.---

If you prefer, you can add a "--" before the file, to tell rm that everything after this is to be taken literally:

cd /var/tmp/old
rm -- --------.---

If that doesn't work for some reason, try escaping the file:

cd /var/tmp/old
rm ./\--------.---

And if THAT doesn't work either, post back to let me know I'm mistaken
  #3 (permalink)  
Old 07-16-2001
Registered User
 

Join Date: Jun 2001
Location: Nothern Sweden
Posts: 9
If you are going to delete a directory you can use..

rm -r directoryname

then it deletes all files in the dir also..

caution though, there is no "are you sure" questions....
  #4 (permalink)  
Old 07-17-2001
ghoti's Avatar
Registered User
 

Join Date: Jul 2001
Location: Wales
Posts: 55
I had to have a go at this, so I tried using "rm -riv [parentdir]"
It will descend and ask for confirmation before deletion of each file. I had no problems removing the testfile....

$ rm -riv test
rm: descend into directory `test'? y
removing all entries of directory test
rm: remove `test/foo'? n
rm: remove `test/foo1'? n
rm: remove `test/foo4'? n
rm: remove `test/foo2'? n
rm: remove `test/--------.---'? y
removing test/--------.---
rm: remove `test/foo3'? n
rm: remove directory `test' (might be nonempty)? n
$

HAHA, I just reread the original post, I though you just wanted to remove the file, and keep the rest of the directory..... still may come in handy for someone....
-gHoTi
__________________
regards,

-ghoti

Last edited by ghoti; 07-17-2001 at 09:18 AM.
  #5 (permalink)  
Old 07-17-2001
Registered User
 

Join Date: Jul 2001
Posts: 1
Perhaps you have to log in as the root.
  #6 (permalink)  
Old 07-17-2001
Registered User
 

Join Date: Jul 2001
Location: Papua New Guinea
Posts: 2
Response to Removing Files

Thanks so much for your responses, what a great board this is.
I took the easy way out and took nick30 advice and used 'rm -r filename', which worked a treat. Thanks for all your responses.
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0