Maybe I'm not understanding, but if you wire it to a for loop and indexing is on, the loop will stop when the last element in indexed in, just don't wire the loop count.
If you do wire the lop count, you'd still never exceed the array. You'd just take a subset of the array if the count terminal was a smaller number.
Simple answer: compare iteration index with array size.
For more detailed answer we need VI with algorithm (C) Bob
If you are using for loop, you know number of iterations you want to execute. If you want to abort on some condition (file has bad name), you know this condition.
Recursive usually means while loop: you add files to the list and process them one by one. You add to the end of array, process from beginning. You may need to keep counter in shift register and increment it every time you process file.
Check recursive file list.vi from the Advanced file functions, it might help
Probably if we knew why you needed to do this, we could give you a much more complete answer.
For instance, if you just need to iterate over the array, autoindexing will cause the loop to exit after the last element of the array was worked on.