Jarves\Filesystem\WebFilesystem::copyFolder PHP Method

copyFolder() public method

public copyFolder ( $from, $to )
    public function copyFolder($from, $to)
    {
        $fs = $this->getAdapter($to);
        $fs->mkdir($this->normalizePath($to));
        $normalizedPath = $this->normalizePath($to);
        $files = Finder::create()->in($from);
        $result = true;
        foreach ($files as $file) {
            $newName = $normalizedPath . '/' . substr($file, strlen($from) + 1);
            if (is_dir($file)) {
                $result &= $fs->mkdir($this->normalizePath($newName));
            } else {
                $result &= $fs->write($this->normalizePath($newName), file_get_contents($file));
            }
        }
        return $result;
    }