Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Feb 2000 11:52:47 -0600
From:      Scott Johnson <tmtowtdi@mailandnews.com>
To:        Mauricio Marquez <mmarquez@enlace.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: deleting a nasty directory entry
Message-ID:  <3899C06F.41C67EA6@mailandnews.com>
References:  <3.0.32.20000203105930.017d86e0@enlace.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Mauricio Marquez wrote:
> 
> How do I go about deleting a nasty directory entry that goes something like:
> 
> ???`???Nop???KUI??o?N?k
> 
> If I try rm I get Unmatched ` . Big mistake if I try rm ???*.* or something
> similar.
> 
> It just bothers me that itīs there everytime I ls.
> 

That certainly would be a mistake. What's wrong with

   $ rm ???\`???Nop???KUI??o?N?k

This matches your nonprinting chars (shown by '?' in your directory
listing) using bash's single character wildcard '?'. The printing chars
are matched literally, and we take care to escape the special char '`'.
Also, when you're stuck with a file with a funky name, you can use `ls
-i` to get the inode number, then let find(1) pass the file to rm(1):

   $ find . -inum $number_you_got_from_ls exec rm {} \;

Scott


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3899C06F.41C67EA6>