1.20.x backdrop_web_test_case.php private BackdropWebTestCase::recursiveCopy($src, $dst)

Recursively copy one directory to another.

Parameters

string $src: Source directory to copy.

string $dst: Destination directory to copy files to.

File

modules/simpletest/backdrop_web_test_case.php, line 1649

Class

BackdropWebTestCase
Test case for typical Backdrop tests.

Code

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