Date: Thu, 19 Sep 2002 09:12:26 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Peter Leftwich <Hostmaster@Video2Video.Com> Cc: FreeBSD LIST <FreeBSD-Questions@FreeBSD.ORG> Subject: Re: find case-insensitive challenge Message-ID: <20020919061225.GE39149@hades.hell.gr> In-Reply-To: <20020919013548.H83658-100000@earl-grey.cloud9.net> References: <20020919013548.H83658-100000@earl-grey.cloud9.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2002-09-19 01:38, Peter Leftwich <Hostmaster@Video2Video.Com> wrote: > Tonight I surprised myself by running > `find ~/Desktop/folder/ -name "*.jpg" -exec mv {} ~/Desktop/folderjpgs/ \;` > But there were two issues -- I had to escape the semicolon with a "\" -- > does this ever cause problems for find command lines? The `\' character makes sure that your shell doesn't intepret ';' in the usual sense (as a command separator). > Second, this found only *.jpg files and left behind *.JPG files so > how do you make find be case-insensitive? -exec ThankYouScript.sh {} \; Two ways. a) Use -iname instead of -name. b) Use filename globbing, as in: find folder/ -name '*.[mM][pP]3' The character classes [mm] and [pP] make sure that both variations of each character are considered valid matches. This is my preferred way of matching files when I only want to ignore the case of one or two characters. -- Giorgos Keramidas <keramida@{ceid.upatras.gr,freebsd.org}> FreeBSD 4.6-RELEASE #0: Wed Sep 18 23:08:01 EEST 2002 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?20020919061225.GE39149>