LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Single find command to find multiple files? (http://www.linuxquestions.org/questions/linux-newbie-8/single-find-command-to-find-multiple-files-700812/)

thok 01-29-2009 09:32 AM

Single find command to find multiple files?
 
i want to find multiple files with a single find command

for example i want to find files with foo and bar in their name on my webserver... how can i do it with a single find command?

colucix 01-29-2009 09:50 AM

You can use two different patterns using two -name tests separated by a logical OR. The syntax is highlighted in red below:
Code:

find . \( -name \*foo\* -o -name \*bar\* \)

r3sistance 01-29-2009 10:35 AM

next time you need an example. please just say foo and bar... I dread it when I see lines I have in script files in... err nevermind :).

colucix 01-29-2009 10:39 AM

Sorry... erroneous post.

Tinkster 01-29-2009 03:12 PM

Quote:

Originally Posted by r3sistance (Post 3425359)
next time you need an example. please just say foo and bar... I dread it when I see lines I have in script files in... err nevermind :).

I totally second this notion. Not that I'm that prudish, but
LQ is supposed to be accessible to underage folk, and we'd like
to keep the language clean.

For this reason I took the liberty to make the posts a bit
more in line with the general concept ;}


Cheers,
Tink

colucix 01-29-2009 04:07 PM

Quote:

Originally Posted by Tinkster (Post 3425653)
For this reason I took the liberty to make the posts a bit more in line with the general concept ;}

I agree. I'm very sorry... I should have thought about the underage audience.

thok 01-30-2009 03:58 AM

sorry ... i actually explained the exact situation i needed this command for ... to search for illegal files on my webserver hosted by users.

Tinkster 01-31-2009 04:45 PM

Well ... for future reference: if things you're looking for
may appear dodgy, please take the time to sanitise/anonymise
whatever you're looking for. Your example is easily enough
transformed back and forth to foo, bar, baz w/o too much hassle
or extraordinary cognitive effort.


All times are GMT -5. The time now is 10:00 AM.