Renaming Files on Hoary

Stephen R Laniel steve at laniels.org
Tue Jun 14 23:29:17 UTC 2005


On Tue, Jun 14, 2005 at 11:19:10PM +0100, Tony Arnold wrote:
> I was always amused to compare the verbosity of the above solution to
> how it's done on OpenVMS, which is often accused of being verbose. The
> equivalent would be:
> 	rename [...]*.xxx .yyy

Same with MS-DOS: you'd do rename *.JPG *.jpg. I'm a little
unsure how you'd get the same feature in the various Unices,
because the shell handles globbing. So before 'rename' had a
chance to get at the list of files, 'rename *.JPG *.jpg'
would have turned into

rename a.JPG b.JPG c.JPG *.jpg

And this would be no good. So at the very least you'd have
to do

rename '*.JPG' '*.jpg'

to avoid shell interpretation. But then you're stuck, I
think; you need your version of 'rename' to be able to parse
'*.JPG' and figure out what to do with '*.jpg'.

Which is why the Perl command

rename 's/JPG/jpg/g' *.JPG

is pretty nice. It's extremely powerful, and not that
verbose.

-- 
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050614/1450086d/attachment.sig>


More information about the ubuntu-users mailing list