diff --git a/system/src/Grav/Console/Cli/SandboxCommand.php b/system/src/Grav/Console/Cli/SandboxCommand.php
index 125fe7d0a..2d36ba8c3 100644
--- a/system/src/Grav/Console/Cli/SandboxCommand.php
+++ b/system/src/Grav/Console/Cli/SandboxCommand.php
@@ -2,6 +2,7 @@
namespace Grav\Console\Cli;
use Grav\Common\Filesystem\Folder;
+use Grav\Common\Utils;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputArgument;
@@ -188,7 +189,7 @@ class SandboxCommand extends Command
$to = $this->destination . $target;
$this->output->writeln(' ' . $source . ' -> ' . $to);
- $this->rcopy($from, $to);
+ Utils::rcopy($from, $to);
}
}
@@ -326,42 +327,4 @@ class SandboxCommand extends Command
exit;
}
}
-
- /**
- * @param $src
- * @param $dest
- *
- * @return bool
- */
- private function rcopy($src, $dest)
- {
-
- // If the src is not a directory do a simple file copy
- if (!is_dir($src)) {
- copy($src, $dest);
- return true;
- }
-
- // If the destination directory does not exist create it
- if (!is_dir($dest)) {
- if (!mkdir($dest)) {
- // If the destination directory could not be created stop processing
- return false;
- }
- }
-
- // Open the source directory to read in files
- $i = new \DirectoryIterator($src);
- /** @var \DirectoryIterator $f */
- foreach ($i as $f) {
- if ($f->isFile()) {
- copy($f->getRealPath(), "$dest/" . $f->getFilename());
- } else {
- if (!$f->isDot() && $f->isDir()) {
- $this->rcopy($f->getRealPath(), "$dest/$f");
- }
- }
- }
- return true;
- }
}