you are closing the dirhandle IN the loop instead of after it. Just move the 'closedir' line after the following '}'
This is an example why it is better to use well-tested library code instead of redoing the same tasks over and over again. Take a look at File::Find, it might make your task easier next time.
In reply to Re: Bad file descriptor error
by jethro
in thread Bad file descriptor error
by Lamont85
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |