From owner-freebsd-questions Tue Jan 9 13:13:24 2001 Delivered-To: freebsd-questions@freebsd.org Received: from post.mail.nl.demon.net (post-11.mail.nl.demon.net [194.159.73.21]) by hub.freebsd.org (Postfix) with ESMTP id 89B8237B6A0 for ; Tue, 9 Jan 2001 13:13:04 -0800 (PST) Received: from [212.238.77.116] (helo=willow.raggedclown.net) by post.mail.nl.demon.net with smtp (Exim 3.14 #4) id 14G64f-0000nG-00; Tue, 09 Jan 2001 21:12:58 +0000 Received: from buffy.raggedclown.net (btvs.demon.nl [192.168.1.2]) by willow.raggedclown.net (Postfix) with ESMTP id 676245DA3; Tue, 9 Jan 2001 22:12:27 +0100 (CET) Received: by buffy.raggedclown.net (Postfix on SuSE Linux 7.0 (i386), from userid 500) id C15E712C1E; Tue, 9 Jan 2001 22:11:56 +0100 (CET) Date: Tue, 9 Jan 2001 22:11:56 +0100 From: Cliff Sarginson To: Peter Brezny Cc: freebsd-questions@FreeBSD.ORG Subject: Re: A simple shell question, How do i rename multiple files? Message-ID: <20010109221156.C1287@buffy.raggedclown.net> References: <003101c07a95$b24117a0$46010a0a@sysadmininc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <003101c07a95$b24117a0$46010a0a@sysadmininc.com>; from peter@sysadmin-inc.com on Tue, Jan 09, 2001 at 03:41:31PM -0800 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Jan 09, 2001 at 03:41:31PM -0800, Peter Brezny wrote: > I've got a bunch of files all ending in the same extension (somename.xxx) > > I want to rename all of them to just (somename) > > I've tried > mv *.xxx * > > the same format with cp meaning what ? The above cp command will fail unless by chance the very last file expanded by "*" is a directory, then it will cp all .xxx files and all files into that directory .. which I am sure is not what you understand it to do. > > i've read the mv man page. > for i in *.xxx; do mv $i `echo $i | sed "s/\.xxx//"`; done Cliff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message