There is a JSL error, I think, here
If( Ends With( y[i], "csv" ),
0 // need something here, a zero is good enough
,
Remove From( y, i )
)
the two adjacent commas need something between them. A 0 is a very tiny expression that evaluates to 0 and does nothing else. (Or switch the logic around with !EndsWith(...) where ! means NOT.)
Craige