Warren #1 you should probably have: file_num = t Your current code will check for the existence of "001.ITM", 5 times.