copying files with same name
Erik Trulsson
ertr1013 at student.uu.se
Tue Feb 17 08:21:29 PST 2004
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 at student.uu.se
More information about the freebsd-questions
mailing list