opendir($dh,"C:/"); while($var = readdir($dh)){ if(-d $var){ print "$var\n"; } } close $fh;