Date: Tue, 17 Feb 2004 17:21:26 +0100 From: Erik Trulsson <ertr1013@student.uu.se> To: Dru <dlavigne6@sympatico.ca> Cc: questions@freebsd.org Subject: Re: copying files with same name Message-ID: <20040217162126.GA60260@falcon.midgard.homeip.net> In-Reply-To: <20040217105935.D629@genisis.domain.org> References: <20040216163818.R609@genisis.domain.org> <20040216223158.GA12956@falcon.midgard.homeip.net> <20040217100421.R629@genisis.domain.org> <20040217154814.GA46529@falcon.midgard.homeip.net> <20040217105935.D629@genisis.domain.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
ertr1013@student.uu.se
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040217162126.GA60260>
