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

Re: how to rename multiple files



Colin Watson said:

> On Tue, Dec 10, 2002 at 11:20:31AM -0800, Osamu Aoki wrote:
>> if [ -e *.JPG ]; then for i in *.JPG; do mv "$i" "${i%.JPG}.jpg";
>> done fi
>
> That -e test looks dreadful ... surely it'll usually expand to lots of
> arguments which will confuse [, or perhaps to an empty string
> (nullglob)
> which will also confuse test?
>
> --
> Colin Watson
> [cjwatson@flatline.org.uk]

And I've bumped into this. How *DOES* one test for the existence of
ANY file with a given extension without getting a "too many arguments"
error when there are multiple files?

I want "TRUE" if there is one or more zzz.jpg files in a directory,
"FALSE" if there are zero of them.

G


-- 
Gerald
http://www.phorce1.com
http://www.buskatiers.org



Reply to: