Batch rename

Florian Diesch diesch at spamfence.net
Fri Aug 21 13:15:18 UTC 2009


Jim Farrow <jimf at graybox.co.uk> writes:

> On Thu, 2009-08-20 at 19:08 -0400, Keith Clark wrote:
>> I need a command to rename quite a few files (25) from a .jpeg extension
>> to a .jpg extension.
>> 
>> Keith
>> 
>> 
>> 
>
> I'm not an expert but this works for me.
>
> for i in *.jpeg; do mv $i `echo $i|sed 's/jpeg/jpg/'`; done

It doesn't work for files that have whitespace in there names or have
"jpeg" not only as extension but somewhere else in the name.



   Florian
-- 
<http://www.florian-diesch.de/>




More information about the ubuntu-users mailing list