in reply to Re: recurse directories and sub-directories
in thread recurse directories and sub-directories
You're much better off using File::Find than reinventing the wheel like this.
Firstly, your code will only work on Windows, or any other OS where the directory separator is \. File::Find deals with this transparently. Also you're not checking for failure. What happens if the chdir ($d) fails, maybe because the directory specified in $d doesn't exist?
The first two lines to match for the current or parent directory could be rewritten as next if $file =~ /^\.{1,2}$/;.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re:x3 recurse directories and sub-directories (bad code warning)
by grinder (Bishop) on Oct 12, 2001 at 16:38 UTC | |
by dkubb (Deacon) on Oct 12, 2001 at 18:43 UTC |