示例#1
0
function dcopy($source, $destination)
{
    if (!is_dir($source)) {
        echo "ERROR: THE" . $source . " is not a directory!";
        return 0;
    }
    if (!is_dir($destination)) {
        mkdir($destination);
    } else {
        return 0;
    }
    $handle = dir($source);
    while ($entry = $handle->read()) {
        if ($entry != '.' && $entry != '..') {
            if (is_dir($source . "/" . $entry)) {
                dcopy($source . "/" . $entry, $destination . "/" . $entry);
            } else {
                copy($source . "/" . $entry, $destination . "/" . $entry);
            }
        }
    }
    return 1;
}
示例#2
0
 function dcopy($old, $new)
 {
     is_dir($new) or mkdir($new, 0755, TRUE);
     foreach (glob($old . '/*') as $v) {
         if ($v != 'upload/install.php') {
             $to = $new . '/' . basename($v);
             is_file($v) ? copy($v, $to) : dcopy($v, $to);
         }
     }
     return TRUE;
 }