From owner-freebsd-questions@FreeBSD.ORG Tue Feb 17 08:21:29 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0889E16A4CE for ; Tue, 17 Feb 2004 08:21:29 -0800 (PST) Received: from falcon.midgard.homeip.net (h201n1fls24o1048.bredband.comhem.se [212.181.162.201]) by mx1.FreeBSD.org (Postfix) with SMTP id E717B43D2D for ; Tue, 17 Feb 2004 08:21:27 -0800 (PST) (envelope-from ertr1013@student.uu.se) Received: (qmail 60290 invoked by uid 1001); 17 Feb 2004 16:21:26 -0000 Date: Tue, 17 Feb 2004 17:21:26 +0100 From: Erik Trulsson To: Dru Message-ID: <20040217162126.GA60260@falcon.midgard.homeip.net> Mail-Followup-To: Dru , questions@freebsd.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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040217105935.D629@genisis.domain.org> User-Agent: Mutt/1.5.6i cc: questions@freebsd.org Subject: Re: copying files with same name X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Feb 2004 16:21:29 -0000 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"' \; -- Erik Trulsson ertr1013@student.uu.se