Skip site navigation (1)Skip section navigation (2)
Date:      19 Sep 2002 09:20:43 -0400
From:      Matt Smith <matt@forsetti.com>
To:        "Brian T. Schellenberger" <bts@babbleon.org>
Cc:        Peter Leftwich <Hostmaster@Video2Video.Com>, FreeBSD LIST <FreeBSD-Questions@FreeBSD.ORG>
Subject:   Re: find case-insensitive challenge
Message-ID:  <1032441644.1295.2.camel@localhost>
In-Reply-To: <200209190757.22640.bts@babbleon.org>
References:  <20020919013548.H83658-100000@earl-grey.cloud9.net>  <200209190757.22640.bts@babbleon.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Or, try "-iname" instead of "-name"

man find
...
 -iname pattern
             Like -name, but the match is case insensitive.
...

Hope that helps,
-Matt

On Thu, 2002-09-19 at 07:57, Brian T. Schellenberger wrote:
> 
> 
> 
> On Thursday 19 September 2002 01:38 am, Peter Leftwich wrote:
> | Tonight I surprised myself by running `find ~/Desktop/folder/ -name
> | "*.jpg" -exec mv {} ~/Desktop/folderjpgs/ \;` successfully!  My first
> | custom find command line ever.
> |
> | But there were two issues -- I had to escape the semicolon with a "\"
> 
> Yes, it always works that way.
> 
> | -- does this ever cause problems for find command lines? 
> 
> No, not really.
> 
> | Second,
> | this found only *.jpg files and left behind *.JPG files so how do you
> | make find be case-insensitive?
> 
> find ~/Desktop/folder/ \( -name "*.jpg" -o -name "*.JPG" \)  \
>      -exec mv {} ~/Desktop/folderjpgs/ \;
> 
> Actually, what *I* do is avoid having files with capital letters in 
> them, or spaces, or &'s, or any of those other goofy characters you 
> sometimes find in Windows file names.  Then I don't have to do the 
> above.  I accomplish that with the attached pair of scripts, though 
> there are no doubts lots of other nice ways to do this.
> 
> (I run the "unmsdos" script over files that I download from the web or 
> newsgroups or what-have-you.  It makes all of file names 
> "Unix-friendly" and, if the file is a text file, it invokes uncrnl to 
> change the cr-nl's at the ends of lines into just plan nl's.)
> 
> | -exec ThankYouScript.sh {} \;
> 
> -- 
> Brian, the man from Babble-On . . . .   bts@babbleon.org (personal)



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?1032441644.1295.2.camel>