[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: New vendor drops on vendor branch - but how?

From: Bob Proulx <bob_at_proulx.com>
Date: 2006-08-21 01:08:38 CEST

Gavin Lambert wrote:
> > find . -type d -name .svn -prune -o -type f -print0 | xargs -r0 ls -ldog
> Yes, someone else suggested the same thing the next day.
>
> I didn't like the find with grep either, but (since I had forgotten the
> '-o -type f -print' bit) using just -prune resulted in printing all the
> .svn folders, not all *but* the .svn folders. I was in a hurry, so I
> didn't have time to experiment much further :)
>
> The man page I've got on find wasn't particularly forthcoming either,
> and didn't explain how -prune interacts with the other options.

The -prune option causes find to stop recursing down that path. This
prevents find from walking down the .svn directories. And it returns
true like almost all other find options. True and false are important
because find executes the -options as a little program. The -o and -a
generate OR and AND constructs with short-circuit logical evaluation
of the booleans.

  find . -- walk all of the directores below here
  -type d -- true if a directory, false if not
  -name .svn -- if here after -type d above then must be a directory
                with name .svn, effectively -type d AND -name .svn
                since the AND is always implied
  -prune -- if here after above stop traversing and skip this dir,
                return true
  -o -- a logical OR. if the above was true then because true
                OR anything is true stop evaulating. if false for
                any of reason then evaulate right-hand-side of OR
             -- RHS of OR here
  -type f -- true if a file, false if not
  -print0 -- if here after above then must be a file
                print the path null terminated

The AND is the default connection between options. But this could be
written more verbosely with all of the implied ANDs like this.

  find . -type d -and -name .svn -and -prune -or -type f -print

But I actually find that much harder to read, not easier, and so I
prefer the previous.

  find . -type d -name .svn -prune -o -type f -print

Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Aug 21 01:09:19 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.