Return to BSD News archive
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!quagga.ru.ac.za!nntp.und.ac.za!beastie.cs.und.ac.za!harverso
From: harverso@beastie.cs.und.ac.za (Tony Harverson )
Newsgroups: comp.unix.bsd
Subject: Re: Removing a file with a leading "-" in the name
Date: 23 Feb 1995 18:26:05 GMT
Organization: University of Natal (Durban), South Africa
Lines: 25
Message-ID: <3iijvt$f2r@owl.und.ac.za>
References: <1995Feb20.023938.20960@rai.juice.or.jp> <3ii3lt$m9b@crl3.crl.com>
NNTP-Posting-Host: beastie.cs.und.ac.za
X-Newsreader: TIN [version 1.2 PL2]
Ron Wickersham (rjw@crl.com) wrote:
: Tetsuji Rai (tetsuji@rai.juice.or.jp) wrote:
: : The title says it all. I wonder how to remove a file with "-" in the
: : begining of file name (such as "-foo"). You must not program for that.
: : Simply use unix commands. I just made a file "-.rej" by mistake, and
: : wondering how to erase it without programming. Somehow rm recognizes
: : "-" character as an option.
An interesting version of this question I got out of a set of notes on a SCO
course was this....
use ls -i to find the inum of the file.
find /path/ -inum <number> -exec rm {} \;
It seems to work on most - anyone know of a case when it won't ?
chus
Tony
--
~~~|~~~ aka: Tony Harverson - the #za Stalker
| rog = harverso@beastie.cs.und.ac.za
coder for |~\ //~~~~ \\ //
| | //== >><<
|_/ubious // // \\ Demo Team