public function digipolisMirrorDir($dir, $destination)
    {
        if (!is_dir($dir)) {
            return;
        }
        $task = $this->taskFilesystemStack();
        $task->mkdir($destination);

        $directoryIterator = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
        $recursiveIterator = new \RecursiveIteratorIterator($directoryIterator, \RecursiveIteratorIterator::SELF_FIRST);
        foreach ($recursiveIterator as $item) {
            $destinationFile = $destination . DIRECTORY_SEPARATOR . $recursiveIterator->getSubPathName();
            if (file_exists($destinationFile)) {
                continue;
            }
            if (is_link($item)) {
                if ($item->getRealPath() !== false) {
                    $task->symlink($item->getLinkTarget(), $destinationFile);
                }
                continue;
            }
            if ($item->isDir()) {
                $task->mkdir($destinationFile);
                continue;
            }
            $task->copy($item, $destinationFile);
        }
        return $task;
    }
public function digipolisMirrorDir($dir, $destination)
    {
        if (!is_dir($dir)) {
            return;
        }
        $task = $this->taskFilesystemStack();
        $task->mkdir($destination);

        $directoryIterator = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
        $recursiveIterator = new \RecursiveIteratorIterator($directoryIterator, \RecursiveIteratorIterator::SELF_FIRST);
        foreach ($recursiveIterator as $item) {
            $destinationFile = $destination . DIRECTORY_SEPARATOR . $recursiveIterator->getSubPathName();
            if (file_exists($destinationFile)) {
                continue;
            }
            if (is_link($item)) {
                if ($item->getRealPath() !== false) {
                    $task->symlink($item->getLinkTarget(), $destinationFile);
                }
                continue;
            }
            if ($item->isDir()) {
                $task->mkdir($destinationFile);
                continue;
            }
            $task->copy($item, $destinationFile);
        }
        return $task;
    }
public function digipolisMirrorDir ( $ dir , $ destination ) { if ( ! is_dir ( $ dir ) ) { return ; } $ task = $ this -> taskFilesystemStack ( ) ; $ task -> mkdir ( $ destination ) ; $ directoryIterator = new \ RecursiveDirectoryIterator ( $ dir , \ RecursiveDirectoryIterator :: SKIP_DOTS ) ; $ recursiveIterator = new \ RecursiveIteratorIterator ( $ directoryIterator , \ RecursiveIteratorIterator :: SELF_FIRST ) ; foreach ( $ recursiveIterator as $ item ) { $ destinationFile = $ destination . DIRECTORY_SEPARATOR . $ recursiveIterator -> getSubPathName ( ) ; if ( file_exists ( $ destinationFile ) ) { continue ; } if ( is_link ( $ item ) ) { if ( $ item -> getRealPath ( ) !== false ) { $ task -> symlink ( $ item -> getLinkTarget ( ) , $ destinationFile ) ; } continue ; } if ( $ item -> isDir ( ) ) { $ task -> mkdir ( $ destinationFile ) ; continue ; } $ task -> copy ( $ item , $ destinationFile ) ; } return $ task ; }
Mirror a directory.

@param string $dir
Path of the directory to mirror.
@param string $destination
Path of the directory where $dir should be mirrored.

@return \Robo\Contract\TaskInterface
The mirror dir task.
Mirror a directory .