Unix Shell - Re: How do I find file "findme" in tree "bigtree" searching only s

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > August 2007 > Re: How do I find file "findme" in tree "bigtree" searching only s





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 Re: How do I find file "findme" in tree "bigtree" searching only s
Bill Marcum

2007-08-22, 1:22 am

On Tue, 21 Aug 2007 22:01:36 -0000, Chris Allen
<ca.allen@gmail.com> wrote:
>
>
> How do I find file "findme" in tree "bigtree" searching only
> subdirectories named "in_here"?
> I've been pulling my hair out for an hour or so trying to figure out
> how to do this with the find command.
>
> I haven't even gotten as far as searching for the "findme" fille I
> can't even get find to work and find me all files that are in subdirs
> named "in_here"
>
> I thought this would work for that:
>
> $ find "bigtree" ! -name "in_here" -prune
>
> Why doesn't this work? To me this means "find all files in 'bigtree',
> but don't descend into any directories not named 'in_here'" but
> clearly this is not what find thinks...
>
> Anybody know how to do this?
>

The problem is that bigtree is pruned. Try:
find "bigtree"/* ! -name "in_here" -prune
find "bigtree" ! -name "bigtree" ! -name "in_here" -prune

Because the shell expands wildcards, the first line will ignore hidden
files or directories.


--
Eating chocolate is like being in love without the aggravation.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com