info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bulk-Add


From: Eric Siegerman
Subject: Re: Bulk-Add
Date: Wed, 4 Apr 2001 16:25:27 -0400
User-agent: Mutt/1.2.5i

Maybe I've already pointed this out; can't remember, so I'll do it now:

On Wed, Apr 04, 2001 at 09:23:37AM +0000, schmolle wrote:
> $ cd $WORKINGDIR
> $ find . \( -type d -name "CVS" -prune \) -o \( -type d -exec cvs add {} \; 
> \) 2>/dev/null
> $ find . \( -type d -name "CVS" -prune \) -o \( -type f -exec cvs add {} \; 
> \) 2>/dev/null
> 
> Advantage: This will (iirc) handle file names with spaces [...]

This is the only reason not to use xargs.  If you have GNU
findutils installed, though, you can use their xargs safely, as
follows:

    $ cd $WORKINGDIR
    $ find . \( -type d -name "CVS" -prune \) -o \( -type d -print0 \) | xargs 
-0 cvs add 2>/dev/null
    $ find . \( -type d -name "CVS" -prune \) -o \( -type f -print0 \) | xargs 
-0 cvs add 2>/dev/null

"find -print0" and "xargs -0" say to delimit the pathnames with
'\0' instead of '\n', and to take all other characters literally;
pathnames with funky characters are thus handled correctly.

> ps: I'm writing this code of the top of my head. TEST IT BEFORE YOU USE IT!

Likewise!

--

|  | /\
|-_|/  >   Eric Siegerman, Toronto, Ont.        address@hidden
|  |  /
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea.
        - RFC 1925 (quoting an unnamed source)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]