Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Sep 2003 20:28:19 -0500
From:      Larry Rosenman <ler@lerctr.org>
To:        Jonas <jonas@netwood.net>, freebsd-questions@freebsd.org
Subject:   Re: How do I change the extensions on a slew of files
Message-ID:  <88930000.1062638899@lerlaptop.lerctr.org>
In-Reply-To: <024201c37283$60b7b400$0800a8c0@master>
References:  <024201c37283$60b7b400$0800a8c0@master>

next in thread | previous in thread | raw e-mail | index | archive | help


--On Wednesday, September 03, 2003 18:25:07 -0700 Jonas <jonas@netwood.net> 
wrote:

>
> Hello Know-It-Alls,
>
> If I have a directory with a whole slew of files with the same file
> extension, for example:
>
> 1-1-1.inc
> 1-1-2.inc
> 1-1-3.inc
> etc.
>
> What command can I use to change the file extension - but keep the file
> name the same - in one swell swoop? The equivalent command in Windows
> would be:
>
> C:\>ren *.inc *.htm
>
> Jonas Fornander - System Administrator
> Netwood Communications,LLC - www.netwood.net
> Find out why we're better - 310-442-1530
>
>
from an sh type shell
for i in *.inc
do
z=`echo $i | sed -e "s/inc/htm/g"`
mv ${i} ${z}
done

(not tested, but should work.)

LER

>
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"
>



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?88930000.1062638899>