Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Oct 2005 13:16:22 -0600
From:      "Mark J. Sommer" <msommer@argotsoft.com>
To:        "'Drew Tomlinson'" <drew@mykitchentable.net>, "'FreeBSD Questions'" <freebsd-questions@freebsd.org>
Subject:   RE: Help With Find Syntax
Message-ID:  <200510141916.j9EJGNuo015437@argotsoft.com>
In-Reply-To: <434FFEB4.90308@mykitchentable.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> -----Original Message-----
> From: owner-freebsd-questions@freebsd.org
[mailto:owner-freebsd-questions@freebsd.org] On Behalf Of Drew Tomlinson
> Sent: 10/14/2005 12:54 PM
> To: FreeBSD Questions
> Subject: Help With Find Syntax
> 
> I want to recursively search a directory and return files that end in
".jpg" or ".gif" but I can't seem to get the find syntax right.  My basic
command lines are:
> 
> find /multimedia/Pictures -iname "*.gif" -print
> 
> OR
> 
> find /multimedia/Pictures -iname "*.jpg" -print
> 
> Both of these work perfectly.  But I can't figure out how to combine the
two.  'man find' tells me the the OR operator is '-or'.  Thus it seems that
some incantation along this line would work:
> 
> $ find /multimedia/Pictures -iname "*.gif" -or "*.jpg" -print      
> find: paths must precede expression
> Usage: find [path...] [expression]
> 
> I've tried various placement of quotes, parenthesis, etc. but can't seem
to find the right way to do this.  Can someone show me my error?
> 
> Thanks,
> 
> Drew
> 
Try:

find /multimedia/Pictures \( -iname '*.gif' -o -iname '*.jpg' \)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510141916.j9EJGNuo015437>