Newscoop\Service\Implementation\ThemeManagementServiceLocal::copy PHP Method

copy() protected method

Copies recursivelly the folder content from src to destination.
protected copy ( string $src, string $dst )
$src string The source folder, *(not null not empty).
$dst string the destination folder, *(not null not empty).
    protected function copy($src, $dst)
    {
        $dir = opendir($src);
        if (!file_exists($dst)) {
            mkdir($dst);
        }
        while (false !== ($file = readdir($dir))) {
            if ($file != '.' && $file != '..') {
                if (is_dir($src . '/' . $file)) {
                    $this->copy(rtrim($src, DIR_SEP) . DIR_SEP . $file, rtrim($dst, DIR_SEP) . DIR_SEP . $file);
                } else {
                    $cpres = copy(rtrim($src, DIR_SEP) . DIR_SEP . $file, rtrim($dst, DIR_SEP) . DIR_SEP . $file);
                }
            }
        }
        closedir($dir);
    }