Re: rename v. script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@kendrick JPEGs]$ ls
badly-named.JPG.JPG
[james@kendrick JPEGs]$ rename .JPG .jpg *.JPG
[james@kendrick JPEGs]$ ls
badly-named.jpg.JPG

More UNIXy, and one I haven't seen yet:
[james@kendrick JPEGs]$ ls
badly-named.JPG.JPG
[james@kendrick JPEGs]$ for i in *.JPG ; do mv $i $(basename $i .JPG).jpg ; done
[james@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


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux