#!/usr/bin/perl -w use strict; use Cwd; sub ScanDirectory{ my ($workdir) = shift; my ($depth) = shift; $depth++; my ($startdir) = &cwd; chdir($workdir) or die; opendir(DIR, ".") or die; my @names = readdir(DIR) or die; closedir(DIR); foreach my $name (@names) { next if ($name eq "."); next if ($name eq ".."); if (-d $name) { print &cwd."/".$name."\n"; &ScanDirectory($name, $depth) if $depth <= 1; next; } } chdir($startdir); } &ScanDirectory(".",0);