Subject: Re: upgrade to mv
To: None <tech-userlevel@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-userlevel
Date: 08/15/2001 12:43:49
On Wed, 15 Aug 2001, Hubert Feyrer wrote:
> On Tue, 14 Aug 2001, Robert Schmid wrote:
> > mv -l source will convert the filename to all lower case and
> > mv -u source will convert the filename to all upper case.
>
> What if you have more than one file? What if the last component is a
> directory? I'd prefer to leave case-conversion etc. to tools that call
> mv(1) themselves, instead of bloating mv.

There's a useful perl script called "rename", which has been shipped
as an example in the perl distribution for many years, though we don't
install it from pkgsrc.  If you install it by hand ("make extract"
under pkgsrc/lang/perl5, and then look in the work/perl-<version>/eg
subdirectory) then you will be able to do stuff like

	rename 's/.p$/.pas$/' *.p

to rename all your Pascal source code from *.p to *.pas, or

	rename 'tr/A-Z/a-z/' *

to change all uppercase A-Z to lowercase a-z.

--apb (Alan Barrett)