1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use strict;
use warnings;
my $dir = "c:/test";
my @array;
GetDirs($dir, \@array);
sub GetDirs {
my ($directory, $arrayref) = @_;
$directory =~ s!\\!/!g;
$directory =~ s!/$!!;
if(opendir(my $dir, $directory)) {
while(my %entry = readdir $dir) {
next if $entry =~ m!^\.\.$?!;
my $path = "$directory/$entry";
push @{$arrayref}, $path;
GetDirs($path, $arrayref) if-d $path;
}
closedir $dir;
}
} #End GetDirs
print join("\n", @array);
ungetestet!\n\n
<!--EDIT|esskar|1129552114-->