Renaming Files on Hoary

Stephen R Laniel steve at laniels.org
Tue Jun 14 19:45:16 UTC 2005


On Tue, Jun 14, 2005 at 02:57:26PM -0400, Ed Fletcher wrote:
> Bareword "P1140111" not allowed while "strict subs" in use at (eval 1)
> line 1.
> Bareword "JPG" not allowed while "strict subs" in use at (eval 1) line 1.
> $

You have to tell 'rename' what it should do to each file. I
know it's natural to assume that

rename foo bar

means 'rename file foo so that it's called bar', but I
suspect that 'rename' lets simple jobs like that be handled
by mv(1).

'rename' handles more complicated tasks. E.g., to convert
files to lowercase, do

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

To change every instance of 'foo' in a filename to 'bar', do

rename 's/foo/bar/g' *.JPG

Etc.

I hope that helps.

Steve

-- 
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/299928a4/attachment.pgp>


More information about the ubuntu-users mailing list