Leser: 1
![]() |
|< 1 2 >| | ![]() |
18 Einträge, 2 Seiten |
print $fh "$_\n" for @dirs;
print $fh join("\n", @dirs) . "\n";
find(\&wanted,"d:");
1
2
3
sub wanted{
push @dirs,$File::Find::name if (-d $File::Find::name && "C:/System Volume Information" ne $File::Find::name); # -d für nur Verzeichnisse
}
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
#!perl -w
use strict;
use File::Find;
my @dirs;
find(\&wanted,"C:");
anzahl_readdir ();
#my $file = 'D:/Temp/dir_list.txt';
#open my $dir_list, '>', $file or die "Kann Datei $file nicht anlegen: $!";
#print $dir_list "$_\n" for @dirs;
#close $dir_list;
sub wanted{
push @dirs,$File::Find::name if (-d $File::Find::name && "C:/System Volume Information" ne $File::Find::name); # -d für nur Verzeichnisse
}
sub anzahl_readdir {
my $max_files = 100;
foreach (@dirs) {
opendir(DIR, $_) or die "Kann $_ nicht öffenen: $!";
my @dateien = readdir(DIR);
closedir(DIR);
my $anzahl = ($#dateien -1); # -1 weil readdir die .. Dateien mitliest
if ($anzahl > $max_files) {
print "Es sind $anzahl Dateien im Verzeichnis $_ enthalten\n";
}
}
}
![]() |
|< 1 2 >| | ![]() |
18 Einträge, 2 Seiten |