RE: [redhat-list-de] Mal was für einen perl-Fachmann ...

"Wältner, Thomas" <[email protected]>
Newsgroups gmane.linux.redhat.general.german
Message-ID <DC78DAADB052B54EAA5254C8A462260C0613A8EC@bavaria.m.bui.materna.com>
Hi Jörg,

versuch mal:

#!/usr/bin/perl
$dirname = "/tmp";
$counter = 0;

opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while (defined($file = readdir(DIR))) {
    #print "$dirname$file\n";
    $counter++;
}
closedir(DIR);

print "Anzahl der Dateien: $counter\n"; 

Gruß
Thomas

-----Original Message-----
From: Jörg Linnenkohl
To: [email protected]
Sent: 28/06/2004 18:20
Subject: [redhat-list-de] Mal was für einen perl-Fachmann ...

Hi,

ich suche eine Möglichkeit, elegant in einem
Perlskript festzustellen, wie viele Dateien in einem
Verzeichnis vorhanden sind.
Bisherige Vorschläge waren : ls | wc -l auszuführen
oder eine while-Schleife nach opendir().
Gibt's noch andere Möglichkeiten?

Danke dafür

Gruß
Jörg


_______________________________________________
redhat-list-de mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/redhat-list-de
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.