Wolfgang Wiese: . und .. aus readdir entfernen (script ist anbei)

Beitrag lesen

#!/usr/local/bin/perl

print "Content-Type: text/html\n\n";

$summe_mb=0;

#--Pfad zum Startverzeichnis angeben
$pfad = "/usr/local/etc/httpd/htdocs";

opendir (FILES, "/usr/local/etc/httpd/htdocs");
  @files = readdir(FILES);
  @files = (sort(@files));

. und .. entfernen

shift(@files);
  shift(@files);
closedir (FILES);

Nimm dies:

opendir (FILES, "/usr/local/etc/httpd/htdocs");
@files = sort grep(!/^./, readdir(FILES));
closedir (FILES);

Ciao,
  Wolfgang