Hi Perl Guys, I found this code in the O'Reilly book "Perl for System Administration":
use Cwd; use DirHandle; scan_dir("."); sub scan_dir { my ($workdir) = shift; my ($startdir) = &cwd; chdir ($workdir) or die "$!\n"; opendir(DIR,".") or die "$!\n"; my @names = readdir(DIR) or die "!\n"; closedir(DIR); foreach $name (@names) { next if ($name eq "."); next if ($name eq ".."); if (-d $name) { print "d\n"; scan_dir($name); next; } else { print "f\n"; print "Found file: $name\n"; } chdir ($startdir) or die "$!\n"; } } When I start the script from STARTDIR to scan a win 2000 dir tree with the following entries: STARTDIR\A_DIR\AA_DIR with files in STARTDIR, A_DIR, AA_DIR only the STARTDIR and the A_DIR are recognized as dirs but AA_DIR is recognizes as a file ????? What do I wrong? (Is this correct english??) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]