in reply to Re: How do I read all files in a directory recursively?
in thread How do I read all files in a directory recursively?
Actually, this misses one small but important point. The code contains:
recurse_dir ($_) if -d;
This runs into problems when you see the directories "." and "..", so you need to do something more like:
while (readdir D) { if (-d) { recurse_dir($_) unless ($_ eq '.' or $_ eq '..') } else { process_file($_) if -f } }
|
|---|