ich schaff es leider nicht !!! (
<?
// cp function
function cp($wf, $wto) { // it moves $wf to $wto
mkdir($wto,0777);
$arr = ls_a($wf);
foreach ($arr as $fn) {
if ($fn) {
$fl="$wf/$fn";
$flto="$wto/$fn";
if (is_dir($fl)) {
cp($fl,$flto);
} else {
copy($fl,$flto);
}
}
}
}
// ls_a function
// This function lists a directory.
// AND is needed for the cp function.
function ls_a($wh) {
if ($handle = opendir($wh)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
if (!$files) {
$files = "$file";
} else {
$files = "$file\n$files";
}
}
closedir($handle);
}
$arr = explode("\n",$files);
return $arr;
}
}
HIER mein Aufruf !!!
cp ("images","test");
?>
es wird folgende Fehlermelung ausgegeben:
Warning: readdir(): 1 is not a valid Directory resource in D:\geosnrw\admin\copy-folder.php on line 26