rename v. script
James Wilkinson
fedora at westexe.demon.co.uk
Fri May 20 16:30:34 UTC 2005
Emmanuel Seyman wrote:
> Nitpick : You're assuming that no file contains JPG in its name.
>
> rename .JPG .jpg *.JPG
>
Jeff Kinz wrote:
> Actual implementation details will be left as an exercise for the
> student... ;-)
>
> (Translation - you're right.)
If you want to nitpick... The result of a Windows user getting confused
about extensions:
[James at kendrick JPEGs]$ ls
badly-named.JPG.JPG
[james at kendrick JPEGs]$ rename .JPG .jpg *.JPG
[james at kendrick JPEGs]$ ls
badly-named.jpg.JPG
More UNIXy, and one I haven't seen yet:
[james at kendrick JPEGs]$ ls
badly-named.JPG.JPG
[james at kendrick JPEGs]$ for i in *.JPG ; do mv $i $(basename $i .JPG).jpg ; done
[james at kendrick JPEGs]$ ls
badly-named.JPG.jpg
basename will strip off any leading directory components, and optionally
any suffix.
Hope this helps,
James.
--
E-mail address: james | ... call the editors names I am not allowed to say in
@westexe.demon.co.uk | print, like [censored] and [censored] with a
| [censored] and a wild [censored] in a pink dress.
| -- http://theinquirer.net/?article=20170
More information about the fedora-list
mailing list