public function transfer($source, $path = null)
    {
        $path = $path === null ? $this->output : $path;

        $path = $this->realpath($path);

        $source = (string) $this->realpath($source);

        $directory = new \RecursiveDirectoryIterator($source, 4096);

        $iterator = new \RecursiveIteratorIterator($directory, 1);

        foreach ($iterator as $file) {
            $to = str_replace($source, $path, $from = $file->getRealPath());

            $file->isDir() ? $this->transfer($from, $to) : copy($from, $to);
        }
    }
public function transfer($source, $path = null)
    {
        $path = $path === null ? $this->output : $path;

        $path = $this->realpath($path);

        $source = (string) $this->realpath($source);

        $directory = new \RecursiveDirectoryIterator($source, 4096);

        $iterator = new \RecursiveIteratorIterator($directory, 1);

        foreach ($iterator as $file) {
            $to = str_replace($source, $path, $from = $file->getRealPath());

            $file->isDir() ? $this->transfer($from, $to) : copy($from, $to);
        }
    }
public function transfer ( $ source , $ path = null ) { $ path = $ path === null ? $ this -> output : $ path ; $ path = $ this -> realpath ( $ path ) ; $ source = ( string ) $ this -> realpath ( $ source ) ; $ directory = new \ RecursiveDirectoryIterator ( $ source , 4096 ) ; $ iterator = new \ RecursiveIteratorIterator ( $ directory , 1 ) ; foreach ( $ iterator as $ file ) { $ to = str_replace ( $ source , $ path , $ from = $ file -> getRealPath ( ) ) ; $ file -> isDir ( ) ? $ this -> transfer ( $ from , $ to ) : copy ( $ from , $ to ) ; } }
Transfers files from a directory into another path.

@param  string      $source
@param  string|null $path
@return void
Transfers files from a directory into another path .