List only *.csv files

the strange thing is if I change the code from

 while (lFile.openNext(sd.vwd(), O_READ))

and add a ! it seems to go in to an infinite loop

 while (!lFile.openNext(sd.vwd(), O_READ))

but with out it, it does not seem to run the command at all.