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

Re: Recursive copies of selected files



On Fri, Sep 17, 2004 at 06:28:13AM -0700, Bill Moseley wrote:
> On Thu, Sep 16, 2004 at 06:09:22PM -0700, Stefan O'Rear wrote:
> > > I needed to copy a bunch of files from a directory tree -- but only
> > > selected files (say all regular files that end in .foo).  I want the
> > > destination tree to be created.  find(1) is what I find most useful
> > > for specifying what files to match the files I want to move -- but I
> > > can't seem to get a good xargs command to get the files in the
> > > destination (ie create the dir if doesn't exist and copy the file).
> 
> > It seems the "standard" way to do this is tar in a pipe.
> > 
> > find . | tar -F. -c -f- | (cd ../new && tar -xf -)
> 
> I think you want -T not -F:
> 
>   find -name \*.foo | tar -T- -cf- | (cd newdir && tar -xf-)

Why not just

find -name \*.foo | cpio -pmd newdir

?

Frank

-- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan



Reply to: