phprs\util\FileOp::copys PHP Метод

copys() публичный статический Метод

复制文件或目录
public static copys ( string $src, string $dst, string $except = null ) : boolean
$src string
$dst string
$except string
Результат boolean
    public static function copys($src, $dst, $except = null)
    {
        if (is_file($src)) {
            if ($except !== null && (realpath($except) == realpath($src) || realpath($except) == realpath($dst))) {
                return true;
            }
            return @copy($src, $dst);
        }
        Verify::isTrue(is_dir($src), "{$src} not a file nor a dir");
        $dir = dir($src);
        @mkdir($dst);
        while (false !== ($file = $dir->read())) {
            if ($file != '.' && $file != '..') {
                $src_path = $src . '/' . $file;
                $dst_path = $dst . '/' . $file;
                if (!self::copys($src_path, $dst_path)) {
                    $dir->close();
                    return false;
                }
                Logger::debug("file copy from {$src_path} to {$dst_path}");
            }
        }
        $dir->close();
        return true;
    }