Thank you for your response. I changed the directory-condition check. The readdir(DIR) change puzzles me somewhat. The results appear to unchange either way, and I tested this with simpler programs with identical results. When would I expect the while (readdir(DIR)) to be different from the other?