public function recurse_copy($source, $destination)
    {
        $directory = opendir($source);
        $this->fs->mkdir($destination, 0755);
        while (false !== ($file = readdir($directory))) {
            if (($file != '.') && ($file != '..')) {
                if (is_dir($source . '/' . $file)) {
                    $this->recurse_copy($source . '/' . $file, $destination . '/' . $file);
                } else {
                    $this->fs->copy($source . '/' . $file, $destination . '/' . $file);
                }
            }
        }
        closedir($directory);
    }
public function recurse_copy($source, $destination)
    {
        $directory = opendir($source);
        $this->fs->mkdir($destination, 0755);
        while (false !== ($file = readdir($directory))) {
            if (($file != '.') && ($file != '..')) {
                if (is_dir($source . '/' . $file)) {
                    $this->recurse_copy($source . '/' . $file, $destination . '/' . $file);
                } else {
                    $this->fs->copy($source . '/' . $file, $destination . '/' . $file);
                }
            }
        }
        closedir($directory);
    }
public function recurse_copy ( $ source , $ destination ) { $ directory = opendir ( $ source ) ; $ this -> fs -> mkdir ( $ destination , 0755 ) ; while ( false !== ( $ file = readdir ( $ directory ) ) ) { if ( ( $ file != '.' ) && ( $ file != '..' ) ) { if ( is_dir ( $ source . '/' . $ file ) ) { $ this -> recurse_copy ( $ source . '/' . $ file , $ destination . '/' . $ file ) ; } else { $ this -> fs -> copy ( $ source . '/' . $ file , $ destination . '/' . $ file ) ; } } } closedir ( $ directory ) ; }
Custom function to recursively copy all file and folders in new destination

@param $source
@param $destination
Custom function to recursively copy all file and folders in new destination