On Tue, Feb 17, 2004 at 11:00:07AM -0500, Dru wrote:
> On Tue, 17 Feb 2004, Erik Trulsson wrote:
> 
> > On Tue, Feb 17, 2004 at 10:16:18AM -0500, Dru wrote:
> > > On Mon, 16 Feb 2004, Erik Trulsson wrote:
> > >
> > > > On Mon, Feb 16, 2004 at 04:49:37PM -0500, Dru wrote:
> > > > >
> > > > > Okay, I must be missing something obvious here. How do you do a batch copy
> > > > > while renaming the destination files? I want to copy all of the configure
> > > > > scripts in /usr/ports to ~/scripts. I can get find to find the files, I
> > > > > can get sed to rename them, but I can't get the timing down right.

[snip]

> >
> > An better alternative is to do the copying as find(1) goes down the
> > tree with something like the following one-liner:
> >
> > find /usr/ports -name configure -exec sh -c 'cp {} `echo {} | sed s:/:=:g`' \;
> 
> Thanks. This one and Peder's accomplish the exact same thing :-)

Yes, and mine also has the problems he note with filenames containing
spaces. :-)  (That seems to always be a problem with shell-constructs.)
The following version should handle such files too:

find /usr/ports -name configure -exec sh -c 'cp "{}" "`echo {} | sed s:/:=:g"' \;


-- 
<Insert your favourite quote here.>
Erik Trulsson
[EMAIL PROTECTED]
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to