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?

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 :slight_smile:

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

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

Perhaps you have to log in as the root.

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.:smiley: