Deleting a file where the first character in name is a '-'

Rick Stevens rstevens at vitalstream.com
Wed Sep 8 22:45:13 UTC 2004


Mark Knecht wrote:
> Waldher, Travis R wrote:
> 
>>> -----Original Message-----
>>> From: Mark Knecht [mailto:mknecht at controlnet.com] Sent: Wednesday, 
>>> September 08, 2004 2:33 PM
>>> To: Getting started with Red Hat Linux
>>> Subject: Deleting a file where the first character in name is a '-'
>>>
>>> Hi all,
>>>    Since Rick suggested I'd been absent too long ;-) here's one for 
>>> the team. How do I delete this file? I'm stumped, but that's easy to do.
>>>
>>> flash Images $ ls -la
>>> total 388776
>>> -rw-r--r--   1 mark users   6920582 Apr 28 15:34 
>>> -weed-Onion_Jack-Fake_Moon_Landings.wma
>>> drwxr-xr-x   2 mark users      4096 Sep  8 14:19 .
>>> drwx------  70 mark users      4096 Sep  8 14:12 ..
>>> flash Images $
>>>
>>> I tried quoting it, and back/forward slashing it, but I'm not able to 
>>> get rid of it.
>>>
>>> thanks,
>>> Mark
>>
>>
>>
>> Behold, the power of google:
>>
>> http://www.redhat.com/archives/redhat-list/2003-May/msg00613.html
>>
>> :D
>>
>> I could only find it because my SGI Admin classes taught me about
>> manipulating the inodes; somewhere in my brain I remembered that you
>> could delete them that way.
> 
> 
> Waldher,
>    Thanks. Very weird answer, and yet very beautiful also. I haven't 
> tried it yet. Want to read the man pages a bit, but it's cool that the 
> file name maps back to an inode and that you can manipulate those too.

That's always been true.  I'd extend the google find by saying that,
if you can come up with a pattern that will uniquely identify the file
via "ls", you can:

	find . -name "-viewable-part.*" -exec rm -i -- \{\} \;

The inode method is a bit more elegant, but the above will work.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-        "More hay, Trigger?" "No thanks, Roy, I'm stuffed!"         -
----------------------------------------------------------------------





More information about the Redhat-install-list mailing list