@niemand: Uiteraard als mijn script af is dan zullen er geen sercurety fouten meer zijn, maar het is gewoon nog neit af.
Maar hier is het gedeelte van het schript waar hij in stikt. Hierin zoekt hij via een simpel ls commando uit welke folders en bestanden er in een bepaalde directory staan.(Misschien weet iemand zelfs een betere methode?

)
Code:
sub listdir {
print "<h2>inhoud: <i>$relative$clpath</i></h2>";
@list = split(/\n/, `ls -p -c -h -lt -L --time-style="+%d-%m-%Y %H:%M" "$apath"`);
#print "<PRE>",`ls -p -c -h -lt -L "$apath"`,"</PRE>";
$totalsize = substr(shift (@list),7);
foreach $i (@list) {
$file = substr($i, 60);
$hsize = substr($i,35,8);
$hmod = substr($i,43,16);
$writeabl = substr($i,8,1);
if (substr($i,16,6) eq "nobody" && substr($i,2,1) eq "w") { $writeabl = "w"; }
$hsize =~ s/ //g;
$laatt = substr($file, length($file) - 1);
$dirn = substr($file,0, length($file) - 1);
if ($laatt eq "@") { $laatt = "/"; } #$i = $dirn; }
if ($laatt eq "/") {
@dir = (@dir, $dirn);
%mod = (%mod, $dirn, $hmod);
%write = (%write, $dirn, $writeabl);
} else {
%size = (%size, $file, $hsize);
%mod = (%mod, $file, $hmod);
@files = (@files, $file);
%write = (%write, $file, $writeabl);
}
}
@dir = sort { ($da = lc $a) =~ s/[\W_]+//g;
($db = lc $b) =~ s/[\W_]+//g;
$da cmp $db;
} @dir;
@files = sort { ($da = lc $a) =~ s/[\W_]+//g;
($db = lc $b) =~ s/[\W_]+//g;
$da cmp $db;
} @files;
print "<table><td width=20></td><td width=300>Naam</td><td width=120>Laatst gewijzigd</td><td width=40>Bytes</td><td>Acties</td></table><hr><table>";
$color = $col1;
# Back ( '../' )
print "<td width=20 bgcolor=$col1>
<img src=\"/icons/index.gif\"><br></td><td width=300>
<a href=\"manager.cgi?path=$clpath\">./</a></td><td width=120></td><td width=40></td><td width=40></td>";
if ($clpath ne "/")
{
print "<tr bgcolor=$col2><td width=20>
<img src=\"/icons/back.gif\"><br></td><td width=300>
<a href=\"manager.cgi?path=", join('/',@hdir[0..scalar(@hdir)-2]), "\">../</a></td><td width=100></td><td width=40></td><td width=40></td>";
$color = $col2;
}
# Folders
foreach $i (@dir) {
if ($color eq $col1) { $color= $col2; $pcolor = $pcol2 } else { $color= $col1; $pcolor = $pcol1; }
if ($write{$i} eq "w") { print "\n<tr bgcolor=$color>"; } else { print "\n<tr bgcolor=$pcolor>"; }
print "<td width=20>
<img src=\"/icons/folder.gif\"><br></td><td width=300>
<a href=\"manager.cgi?path=$aclpath/$i\">$i</a></td><td width=120>$mod{$i}</td><td width=40>-</td>";
if ($write{$i} eq "w") { print "<td width=40><a href=\"manager.cgi?path=$clpath\&bestand=$i\&actie=hernoem\">H</a> <a href=\"manager.cgi?path=$clpath\&bestand=$i\&actie=verwijder&folder=true\">V</a></td>";
} else { print "<td width=40></td>"; }
}
# Files
foreach $i (@files) {
if ($i ne "") {
if ($color eq $col1) { $color= $col2; $pcolor = $pcol2 } else { $color= $col1; $pcolor = $pcol1; }
# Find extentions
$numm = 0;
do {
$numm++;
$fext = substr($i, length($i) - $numm);
if ($numm >= 50) { $fext = ".error"; }
} while (substr($fext, 0, 1) ne ".");
$ext = substr($fext, 1);
#if ($icons{$ext} ne "") { $icon = $icons{$ext}; } else { $icon = "unknown.gif"; }
if ($write{$i} eq "w") { print "\n<tr bgcolor=$color>"; } else { print "\n<tr bgcolor=$pcolor>"; }
print "<td width=20><img src=\"/icons/$icon\"><br></td><td width=300><a href=\"$path/$i\">$i</a></td><td width=120>$mod{$i}</td><td width=40>$size{$i}</td>";
if ($write{$i} eq "w") { print "<td width=40><a href=\"manager.cgi?path=$clpath\&bestand=$i\&actie=hernoem\">H</a> <a href=\"manager.cgi?path=$clpath\&bestand=$i\&actie=verwijder\">V</a> ";
} else { print "<td width=40>"; }
print "<a href=\"manager.cgi?path=$clpath\&bestand=$i\&actie=kopieer\">K</a></td>";
}
}
print "</table>";
print "<hr><font color=gray>Totale grootte: $totalsize</font>";
}
sub writelog {
$mess = join('',@_);
open LOGF, ">>$absolute_path$relative/.log/log.html";
print LOGF $mess;
close UPLOADFILE;
}