LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rm -rf a file starting with - (https://www.linuxquestions.org/questions/linux-newbie-8/rm-rf-a-file-starting-with-329179/)

davesbedroom 06-01-2005 09:06 AM

rm -rf a file starting with -
 
I have two files I want to get rid of, but they are

-send.xml
-.xml

so when I try to

rm -rf -send.xml

I get

rm: invalid option -- s
Try `rm --help' for more information.

same problem with -.xml

I tried mv and I get

mv: invalid option -- .
Try `mv --help' for more information.

adding quotes doesn't help, I tried \-send.xml and that doesn't work.

How do you handle files that start with - ?

heema 06-01-2005 09:10 AM

just add -- before the file

e.g.:
Code:

rm -rf -- -send.xml

its in man rm

Code:

To remove a file whose name starts with a `-', for example `-foo', use
one of these commands:

      rm -- -foo

      rm ./-foo



All times are GMT -5. The time now is 01:44 AM.