[thelist] find - solved

Bob Meetin bobm at dottedi.biz
Fri Feb 27 11:47:54 CST 2009


Thx,

I originally tried using an asterisk but it failed, but looking at the 
last option, I added a quote and it now works, and of course does the 
case insensitive version.

find . -name '*whatever*' -exec rm {} \;
find . \( -name '*.[pP][dD][fF]' -o -name '.*.[pP][dD][fF]' \) -print

Thx, you earn the pat on the back!
-Bob


ben morrison wrote:
> how about using * although not sure about CASE sensitivity, probably a 
> flag on find maybe?
>
> find . -name *whatever* -exec rm {} \;
>
> you can also pipe the response and use xargs to remove
>
> find . -name *whatever* | xargs rm
>
> A quick search on case :
>
>
> GNU find has a case-insensitive option '-iname', however
> other 'finds' don't have it and we have to make do with
> the [..] constructs.e.g., to search for all files ending in
> .pdf/.PDF/.pDf/... etc.
>
> find . \( -name '*.[pP][dD][fF]' -o -name '.*.[pP][dD][fF]' \) -print
>
> Ben
>
> On Fri, Feb 27, 2009 at 12:57 PM, Bob Meetin <bobm at dottedi.biz 
> <mailto:bobm at dottedi.biz>> wrote:
>
>     find . -name whatever -exec rm {} \;
>
>     That works to delete all files called 'whatever'. What are the
>     wildcard
>     options with find to find names like whatever as in:
>
>     abc.whatever
>     whatever-xyz
>     def_WHATever
>



More information about the thelist mailing list