# toughy problem? for you gurus, cannot delete a weird named file



## chrcol (Apr 23, 2010)

Somehow I ended up with a file of this name.

-rw-r--r--.xml

I cannot do anything to it, rename or delete it, even doing something like rm *.xml.

This error is generated.


```
rm: illegal option -- w
usage: rm [-f | -i] [-dIPRrvW] file ...
       unlink file
```

any ideas would help a lot thanks.


----------



## DutchDaemon (Apr 23, 2010)

[cmd=]rm -- -rw-r--r--.xml[/cmd] should work.


----------



## mix_room (Apr 23, 2010)

[cmd=""]rm \-rw\-r\-\-r\-\-.xml[/cmd] might also work


----------



## SirDice (Apr 23, 2010)

Or [cmd=]rm ?rw?r??r??.xml[/cmd]


----------



## chrcol (Apr 23, 2010)

DutchDaemon said:
			
		

> [cmd=]rm -- -rw-r--r--.xml[/cmd] should work.



sweet thanks worked, thanks to the other replies also.


----------



## knarf (Apr 23, 2010)

I prefer `$ rm ./-rw-r--r--.xml`, this works on every unixoid system (the -- variant does not). mix_room's and SirDice's solutions will not work at all, because rm still sees the first argument beginning with a dash.


----------



## SirDice (Apr 23, 2010)

Oh, right. That's because the shell expands the wildcards first, before executing the command :r


----------



## fronclynne (Apr 24, 2010)

Just in case you were wondering: from rm(1): 
	
	



```
NOTES
     The rm command uses getopt(3) to parse its arguments, which allows it to
     accept the `--' option which will cause it to stop processing flag
     options at that point.  This will allow the removal of file names that
     begin with a dash (`-').  For example:

           rm -- -filename

     The same behavior can be obtained by using an absolute or relative path
     reference.  For example:

           rm /home/user/-filename
           rm ./-filename
```


----------

