Leser: 4
|< 1 2 >| | 18 Einträge, 2 Seiten |
1
2
3
4
5
6
7
my (@dirs,@files);
opendir(PFAD, "c:\\input")
while(my $entry = readdir(DIR)){
push(@dirs,$entry) if(-d $entry);
push(@files,$entry) if(-f $entry);
}
closedir(PFAD);
Quote
Quote
1
2
3
4
5
6
my $dir = "c:/input";
opendir(DIR, $dir) or die "Error: couldn't open dir '$dir': $!\n";
# oder
unless (opendir(DIR, $dir)) {
die "Error: couldn't open dir '$dir': $!\n";
}
if -d "$dir/$entry"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
my @files; sub findFiles($) { my ($dir) = @_; my $dirhandle; opendir($dirhandle, $dir) || die "can't opendir $dir: $!"; foreach my $entry (readdir($dirhandle)) { if ($entry !~ m{^\.\.?$}) { my $absentry = $dir . '/' . $entry; if (-f $absentry) { push @files, $absentry; } elsif(-d $absentry) { findFiles($absentry); } } } closedir($dirhandle); }
|< 1 2 >| | 18 Einträge, 2 Seiten |