in reply to As usual
in thread Recursive directory scanning
To do that portably, you need to look at File::Spec, since Unix wants forward slash, Windows can handle forward slash but most people expect backslash, Macs want colon, and VMS wants some mixed up mess.
But then you also have to figure out how to skip over symlinks, since that can send you into an infinite loop by turning a DAG into a general node map, bringing you back to where you started too fast.
You also didn't localize your directory handle. In the way you used it, it wouldn't have hurt you, but it it could have potentially stomped on any other use of the same name.
So this is why "recursive directory handling" is nearly always responded with a groan, a sigh, and "please use File::Find". It's an easy task to consider, but a difficult task to actually do right.
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Thanks
by pwhysall (Acolyte) on Mar 01, 2001 at 19:35 UTC | |
by merlyn (Sage) on Mar 01, 2001 at 19:37 UTC |