public function copyr($source, $dest)
    {
        // Simple copy for a file
        if (is_file($source)) {
            return $this->copy($source, $dest);
        }
        // Make destination directory
        if (!is_dir($dest)) {
            $this->mkdir($dest);
        }
        // Loop through the folder
        $dir = $this->dir($source);
        while ( false !== ($entry = $dir->read()) ) {
            // Skip pointers
            if ($entry == '.' || $entry == '..') {
                continue;
            }
            if (!$this->copyable($entry)) {
                continue;
            }
            // Deep copy directories
            if ($dest !== "$source/$entry") {
                $this->copyr("$source/$entry", "$dest/$entry");
            }
        }
        // Clean up
        $dir->close();
        return true;
    }
public function copyr($source, $dest)
    {
        // Simple copy for a file
        if (is_file($source)) {
            return $this->copy($source, $dest);
        }
        // Make destination directory
        if (!is_dir($dest)) {
            $this->mkdir($dest);
        }
        // Loop through the folder
        $dir = $this->dir($source);
        while ( false !== ($entry = $dir->read()) ) {
            // Skip pointers
            if ($entry == '.' || $entry == '..') {
                continue;
            }
            if (!$this->copyable($entry)) {
                continue;
            }
            // Deep copy directories
            if ($dest !== "$source/$entry") {
                $this->copyr("$source/$entry", "$dest/$entry");
            }
        }
        // Clean up
        $dir->close();
        return true;
    }
public function copyr ( $ source , $ dest ) { // Simple copy for a file if ( is_file ( $ source ) ) { return $ this -> copy ( $ source , $ dest ) ; } // Make destination directory if ( ! is_dir ( $ dest ) ) { $ this -> mkdir ( $ dest ) ; } // Loop through the folder $ dir = $ this -> dir ( $ source ) ; while ( false !== ( $ entry = $ dir -> read ( ) ) ) { // Skip pointers if ( $ entry == '.' || $ entry == '..' ) { continue ; } if ( ! $ this -> copyable ( $ entry ) ) { continue ; } // Deep copy directories if ( $ dest !== "$source/$entry" ) { $ this -> copyr ( "$source/$entry" , "$dest/$entry" ) ; } } // Clean up $ dir -> close ( ) ; return true ; }
Copy a file, or recursively copy a folder and its contents; modified
so that copied files, if PHP, have includes removed
@note Adapted from http://aidanlister.com/repos/v/function.copyr.php
Copy a file or recursively copy a folder and its contents ; modified so that copied files if PHP have includes removed