Date: 09 Jan 2001 15:15:32 -0600 From: Tim Ayers <tayers@bridge.com> To: <freebsd-questions@FreeBSD.ORG> Subject: Re: A simple shell question, How do i rename multiple files? Message-ID: <k884bf63.fsf@tim.bridge.com> In-Reply-To: "Peter Brezny"'s message of "Tue, 9 Jan 2001 15:41:31 -0800" References: <003101c07a95$b24117a0$46010a0a@sysadmininc.com>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "P" == Peter Brezny <peter@sysadmin-inc.com> writes: P> I've got a bunch of files all ending in the same extension (somename.xxx) P> I want to rename all of them to just (somename) P> I've tried P> mv *.xxx * This is a surprisingly hard thing to do in UNIX. I don't think there's a way to do it with 'mv'. Here's how to do it with a Perl one-liner . !!!Be sure to change the 'xxx' _in both places_ to whatever your extension is!!! perl -e'for (@ARGV) {($a)=/(.*)\.xxx/; rename $_, $a or die $!}' *.xxx HTH, Tim Ayers (tayers@bridge.com) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?k884bf63.fsf>