I tried it and it still doesn't work. I did get a different output though. I added a "? @ERROR" before and after the script and this was the output:
0
TEMP
18
The manual says that error 18 is "no more files". There are around 20 files in the directory.
Any ideas?

Thanks,
Bonk