25 lip 2008

Lista plików w katalogu

 $sDir = "d:\\do_wysylki" if($sDir eq '');

opendir(SEND_DIR, $sDir)  or die "Couldn't open $dir for reading: $!";

@files = ();
while( defined ($file = readdir(SEND_DIR)) ) {

    next if ($file eq '.' or $file eq '..');

    my $filename = $file;
    push(@files, $filename);
}

closedir(SEND_DIR);

my $count  = @files;