Renaming Files on Hoary
Ed Fletcher
ed at fletcher.ca
Tue Jun 14 20:10:08 UTC 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Stephen R Laniel wrote:
> 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
>
>
That helped a lot Steve. I went through all my directories and fixed
the filenames. I used your first example and it changed the 'P' to a
'p' in each file also. Which is OK. I see that if I'd used your second
example, I could have changed only the extension.
Many thanks,
Ed
- --
Ed Fletcher
ed at fletcher.ca
When one door of happiness closes, another opens;
but often we look so long at the closed door that
we do not see the one which has opened for us.
- - Helen Keller
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCrzmglTbGAQhc1A8RAjYzAJ4kwH3fQvsDALEfCfPYp7OXrfvxxQCggGXn
be+2IykzAVo0OEmET6rLJU8=
=0i1E
-----END PGP SIGNATURE-----
More information about the ubuntu-users
mailing list