Re: how to rename multiple files
On Sat, Jan 04, 2003 at 07:00:03PM -0600, Gerald V. Livingston II wrote:
> 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.
Assuming you don't want the names of the files, just whether they are
there or not:
ls *.ext 2> /dev/null | wc -l
If there are no files you get a 0, if there are you get the number of
them. Thus a non-zero result means TRUE and a zero result means FALSE.
--
Jamin W. Collins
Reply to: