ok finally got the solution:
<?php
$source="E:\\tststs1";
$dest="F:\\tststs1";
copyr($source,$dest);
function copyr($source, $dest)
{
if (is_file($source)) {
return copy($source, $dest);
}
if (!is_dir($dest)) {
mkdir($dest);
}
$dir = dir($source);
while (false !== $entry = $dir->read()) {
if ($entry == '.' || $entry == '..') {
continue;
}
if ($dest !== "$source/$entry") {
copyr("$source/$entry", "$dest/$entry");
}
}
$dir->close();
return true;
}
?>