From owner-freebsd-questions Sat Aug 29 19:06:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA27278 for freebsd-questions-outgoing; Sat, 29 Aug 1998 19:06:08 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA27270 for ; Sat, 29 Aug 1998 19:06:04 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.8.8/8.8.8) id VAA12829; Sat, 29 Aug 1998 21:05:06 -0500 (CDT) (envelope-from dan) Message-ID: <19980829210505.A12635@emsphone.com> Date: Sat, 29 Aug 1998 21:05:05 -0500 From: Dan Nelson To: Patrick Seal , FBSDQ Subject: Re: Renaming multiple files References: <000001bdd3b3$db1d9e40$0100a8c0@local.hyperhost.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.94.2i In-Reply-To: <000001bdd3b3$db1d9e40$0100a8c0@local.hyperhost.net>; from "Patrick Seal" on Sat Aug 29 21:16:46 GMT 1998 X-OS: FreeBSD 2.2.7-STABLE Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Aug 29), Patrick Seal said: > Let's say I have two files in two different directories. > /foo/bar.aaa > /bar/foo.aaa > > I want to rename the extensions to: > /foo/bar.bbb > /bar/foo.bbb > > Can someone give point me to some sort of shell or perl script, or possibly > just a command that can let me do this simultaneously? For one-time replacements, I recommend ports/misc/mmv. Lets you do things like: mmv "*.aaa" "=1.bbb" Or, if you're script-minded or want portability to systems without mmv: for i in */*.aaa ; do mv $i ${i%.aaa}.bbb done should work. If you want to recurse abitrary directory levles, replace */*.aaa with `find . -name "*.aaa"` . -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message