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

Re: how to rename multiple files



On Mon, Dec 09, 2002 at 11:33:03PM -0800, Osamu Aoki wrote:
> Simplest alternative without sub-shell nor special command:
> 
> for i in *.JPG
> do
>   mv $i ${i%\.JPG}.jpg
> done
> 
> It works with any reasonable shell ash/bash/dash/... and uses only mv
> command. 

I like the various clever shell expansions. You don't need the backslash
though (so just ${i%.JPG}) - the pattern is just a shell wildcard, not a
regular expression.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: