I think the solution has already been suggested, I would just like to point you to the documentation (readdir):
If you're planning to filetest the return values out of a readdir, you'd better prepend the directory in question. Otherwise, because we didn't chdir there, it would have been testing the wrong file.
Harry
In reply to Re^3: -f not identifying .txt files
by dHarry
in thread -f not identifying .txt files
by rucha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |