You are here

protected function DrupalWebTestCase::recursiveDirectoryCopy in Drupal 7

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 1599

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);
}