Unix Programming - Looking for a "sophisticated" find script

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > July 2005 > Looking for a "sophisticated" find script





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Looking for a "sophisticated" find script
Generic Usenet Account

2005-07-25, 6:07 pm

I want to launch a "find" query, and I want to exclude some directories
from the search. I am looking for something like this:

find . -type f & excludes specified directories -exec do-something {}
\;

or

find . -type f -exec excluding specified directories do-something {} \;


Thanks,
Gus

rolandberry@hotmail.com

2005-07-25, 6:07 pm



Generic Usenet Account wrote:
> I want to launch a "find" query, and I want to exclude some directories
> from the search. I am looking for something like this:
>
> find . -type f & excludes specified directories -exec do-something {}
> \;
>
> or
>
> find . -type f -exec excluding specified directories do-something {} \;
>
>
> Thanks,
> Gus


pipe the output through grep -v to get rid of the stuff you don't want

Rakesh Sharma

2005-07-25, 6:07 pm



Generic Usenet Account wrote:
> I want to launch a "find" query, and I want to exclude some directories
> from the search. I am looking for something like this:
>
> find . -type f & excludes specified directories -exec do-something {}
> \;
>
> or
>
> find . -type f -exec excluding specified directories do-something {} \;
>



/bin/find . \
\( -type d \( -name xcludir1 -o -name xcludir2 \) -prune \) \
-o \
-exec Do_Something {} \;

Bill Marcum

2005-07-25, 6:07 pm

["Followup-To:" header set to comp.unix.shell.]
On 25 Jul 2005 08:39:15 -0700, Generic Usenet Account
<usenet@sta.samsung.com> wrote:
> I want to launch a "find" query, and I want to exclude some directories
> from the search. I am looking for something like this:
>
> find . -type f & excludes specified directories -exec do-something {}
> \;
>

Look at the "-prune" option.

find . -name excluded_dir -prune -o -type f -exec do_something {} \;


-- Tonight you will pay the wages of sin; Don't forget to leave a tip.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com