function DrupalWebTestCase::recursiveDirectoryCopy

Recursively copy one directory to another.

Parameters

$src: The source directory.

$dest: The destination directory.

1 call to DrupalWebTestCase::recursiveDirectoryCopy()
DrupalWebTestCase::copySetupCache in modules/simpletest/drupal_web_test_case.php
Copy the setup cache from/to another table and files directory.

File

modules/simpletest/drupal_web_test_case.php, line 1660

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

protected function recursiveDirectoryCopy($src, $dst) {
    $dir = opendir($src);
    if (!file_exists($dst)) {
        mkdir($dst);
    }
    while (($file = readdir($dir)) !== FALSE) {
        if ($file != '.' && $file != '..') {
            if (is_dir($src . '/' . $file)) {
                $this->recursiveDirectoryCopy($src . '/' . $file, $dst . '/' . $file);
            }
            else {
                copy($src . '/' . $file, $dst . '/' . $file);
            }
        }
    }
    closedir($dir);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.