From: compboy on
Hi,

Im having problem in using find esp the -prune

I want to find txt files from the path from the command line input
but I dont want to get the txt files from path given on the second
argument

so it will be like this

>./script /$HOME /$HOME/notthis

and my script is about like this

find $1 -name "*.txt"

where should I put the -prune? so the files inside the /notthis
directory will not be listed.

Thanks a lot.

From: Bill Marcum on
On 1 Sep 2006 21:18:36 -0700, compboy
<compboyxyz(a)gmail.com> wrote:
> Hi,
>
> Im having problem in using find esp the -prune
>
> I want to find txt files from the path from the command line input
> but I dont want to get the txt files from path given on the second
> argument
>
> so it will be like this
>
>>./script /$HOME /$HOME/notthis
>
> and my script is about like this
>
> find $1 -name "*.txt"
>
> where should I put the -prune? so the files inside the /notthis
> directory will not be listed.
>
> Thanks a lot.
>
find "$1" -name "$2" -prune -o -name "*.txt"

--
People in general do not willingly read if they have anything else to
amuse them.
-- S. Johnson
From: compboy on
Hmmm,

how if the second argument is a directory?

thanks.
Bill Marcum wrote:
> On 1 Sep 2006 21:18:36 -0700, compboy
> <compboyxyz(a)gmail.com> wrote:
> > Hi,
> >
> > Im having problem in using find esp the -prune
> >
> > I want to find txt files from the path from the command line input
> > but I dont want to get the txt files from path given on the second
> > argument
> >
> > so it will be like this
> >
> >>./script /$HOME /$HOME/notthis
> >
> > and my script is about like this
> >
> > find $1 -name "*.txt"
> >
> > where should I put the -prune? so the files inside the /notthis
> > directory will not be listed.
> >
> > Thanks a lot.
> >
> find "$1" -name "$2" -prune -o -name "*.txt"
>
> --
> People in general do not willingly read if they have anything else to
> amuse them.
> -- S. Johnson

From: compboy on
I have tried to do it that way but it didnt work

thanks
Bill Marcum wrote:
> On 1 Sep 2006 21:18:36 -0700, compboy
> <compboyxyz(a)gmail.com> wrote:
> > Hi,
> >
> > Im having problem in using find esp the -prune
> >
> > I want to find txt files from the path from the command line input
> > but I dont want to get the txt files from path given on the second
> > argument
> >
> > so it will be like this
> >
> >>./script /$HOME /$HOME/notthis
> >
> > and my script is about like this
> >
> > find $1 -name "*.txt"
> >
> > where should I put the -prune? so the files inside the /notthis
> > directory will not be listed.
> >
> > Thanks a lot.
> >
> find "$1" -name "$2" -prune -o -name "*.txt"
>
> --
> People in general do not willingly read if they have anything else to
> amuse them.
> -- S. Johnson

From: Stephane CHAZELAS on
2006-09-1, 23:18(-07), compboy:
> Hmmm,
>
> how if the second argument is a directory?

> >
>> find "$1" -name "$2" -prune -o -name "*.txt"
[...]

Please don't top-post.

Then, you need a find with the -path option.

find "$1" -path "$2" -prune -o -name '*.txt' -print

--
St?phane