rm the un-rm-able file

Ben Yau byau at cardcommerce.com
Thu Sep 23 11:41:19 UTC 2004


> On 14:28 22 Sep 2004, James H. Cutts III <jcutts at coin.org> wrote:
> | Through creative fiddling with my RH 9.0 system, I have managed to 
> | create a file with the name '--exclude=*.work.*' (ticks not included).  
> | I want to delete this file.  Any suggestions on the command or on the 
> | Google search?   I've tried including the file name in  ' (ticks) and  " 
> | (quotes).  Neither resulted in success.
> 
> Naturally quotes won't do anything - "rm" never sees them - they exist purely
> to tell the shell how to interpret strings.
> 
> Consider your problem: the filename resembles an option. So use a different
> filename, like "./--exclude=*.work.*", which doesn't start with a dash:
> 
> 	rm ./--exclude*
> 
> should be perfectly reliable.
> 

If you are careful, you can use wildcard expressions with "rm -i" such as: 

rm -i *exclude* 

works too.  Or any wildcard matching.  The "-i" is interactive and it will go through every file that matches and then ask if you want to remove it or not.  Eventually it will hit the --exclude=*.work* and then after you're done you can ctrl-c out of the "rm" command

Ben






More information about the redhat-list mailing list