src/NaturalWeb/FileStorage/Storage/FileSystemStorage.php
private function copyDir($from, $to)
    {
        mkdir($to, 0777, true);
        
        $items = new FilesystemIterator($from);

        foreach ($items as $item)
        {
            $pattern = preg_quote($from, "/");
            $Key = preg_replace("/^{$pattern}/", "", $item);

            $subFrom = strval($item);
            $subTo   = $to.$Key;
            
            if (filetype($item) == 'dir')
            {
                $this->copyDir($subFrom, $subTo);
            } else {
                $this->copyFile($subFrom, $subTo);
            }
        }

        return true;
    }
private function copyDir($from, $to)
    {
        mkdir($to, 0777, true);
        
        $items = new FilesystemIterator($from);

        foreach ($items as $item)
        {
            $pattern = preg_quote($from, "/");
            $Key = preg_replace("/^{$pattern}/", "", $item);

            $subFrom = strval($item);
            $subTo   = $to.$Key;
            
            if (filetype($item) == 'dir')
            {
                $this->copyDir($subFrom, $subTo);
            } else {
                $this->copyFile($subFrom, $subTo);
            }
        }

        return true;
    }
private function copyDir ( $ from , $ to ) { mkdir ( $ to , 0777 , true ) ; $ items = new FilesystemIterator ( $ from ) ; foreach ( $ items as $ item ) { $ pattern = preg_quote ( $ from , "/" ) ; $ Key = preg_replace ( "/^{$pattern}/" , "" , $ item ) ; $ subFrom = strval ( $ item ) ; $ subTo = $ to . $ Key ; if ( filetype ( $ item ) == 'dir' ) { $ this -> copyDir ( $ subFrom , $ subTo ) ; } else { $ this -> copyFile ( $ subFrom , $ subTo ) ; } } return true ; }
Copy Directory Recursive

@param string $from Path From
@param string $to   Path To

@return bool
@access private
Copy Directory Recursive