Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Sep 1996 16:39:18 -0700 (PDT)
From:      "Eric J. Schwertfeger" <ejs@bfd.com>
To:        hmmm <hmmm@alaska.net>
Cc:        freebsd-questions <questions@FreeBSD.org>
Subject:   Re: multiple files
Message-ID:  <Pine.BSF.3.95.960924163449.19000A-100000@harlie>
In-Reply-To: <Pine.BSF.3.95.960924203341.562B-100000@hmmm.alaska.net>

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


On Tue, 24 Sep 1996, hmmm wrote:

> how can i rename multiple files w/o doing it 1-by-1?
> 
> ie,
> 
> abc.tar.gz > abc.tgz
> def.tar.gz > def.tgz
> hij.tar.gz > hij.tgz

Sounds like a job for perl.  But that's too easy so here's a demented way
do do it in shell script (sh) (assuming there are no other periods in the
file names).

for i in *.tar.gz; do
	mv $i $(echo $i | cut -f 1 -d . ).tgz
done




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.960924163449.19000A-100000>