LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Find excluding multiple directories with a wildcard (http://www.linuxquestions.org/questions/linux-software-2/find-excluding-multiple-directories-with-a-wildcard-359514/)

pteigeler 09-02-2005 10:23 AM

Find excluding multiple directories with a wildcard
 
Here is a very small sample of my current directory structure, not much I can do about it, but I think you get the picture.

./jan2003
./jan2004
./jan2005
./jul2002
./jul2003
./jul2004
./rawOct2003 There are subdirectories here also.
./rawOct2004 There are subdirectories here also.
./rawSep2002 There are subdirectories here also.
./rawSep2003 There are subdirectories here also.
./rawSep2005 There are subdirectories here also.
./rawaug2004 There are subdirectories here also.
./rawjul2004 There are subdirectories here also.
./rawjun2004 There are subdirectories here also.
./rawsep2004 There are subdirectories here also.
./repocommonfiles
./repotempDec2004
./repotempJan2003
./repotempJun2005
./repotempapr2002
./repotempapr2003
./repotempapr2004
./repotempapr2005
./repotempaug2002

Within the "raw" directories, and their subdirectories, are the files I am interested in doing a grep thru after the find command has completed using xargs. The remaining directories I would like to prune during the "find" command. Is there a way to do this without listing every directory in a -prune of its own??? In other words, I want to grep thru all of the files in all of the "raw" directories and all of their subdirectories (no matter what they may start with). I was thinking something like the following...

find . -not -path ./raw\* -prune -o -print | xargs grep abc *.txt

...but couldn't get it to work. Any suggestions? Thanx.

Paul

druuna 09-02-2005 10:57 AM

Hi,

Is this what you want:

find . -path './raw*' -name '*txt' -print

Hope this helps.


All times are GMT -5. The time now is 01:29 PM.