core-bundle/src/Resources/contao/library/Contao/Files.php
public function rcopy($strSource, $strDestination)
	{
		$this->validate($strSource, $strDestination);

		$this->mkdir($strDestination);
		$arrFiles = scan($this->strRootDir . '/' . $strSource, true);

		foreach ($arrFiles as $strFile)
		{
			if (is_dir($this->strRootDir . '/' . $strSource . '/' . $strFile))
			{
				$this->rcopy($strSource . '/' . $strFile, $strDestination . '/' . $strFile);
			}
			else
			{
				$this->copy($strSource . '/' . $strFile, $strDestination . '/' . $strFile);
			}
		}
	}
public function rcopy($strSource, $strDestination)
	{
		$this->validate($strSource, $strDestination);

		$this->mkdir($strDestination);
		$arrFiles = scan($this->strRootDir . '/' . $strSource, true);

		foreach ($arrFiles as $strFile)
		{
			if (is_dir($this->strRootDir . '/' . $strSource . '/' . $strFile))
			{
				$this->rcopy($strSource . '/' . $strFile, $strDestination . '/' . $strFile);
			}
			else
			{
				$this->copy($strSource . '/' . $strFile, $strDestination . '/' . $strFile);
			}
		}
	}
Recursively copy a directory

@param string $strSource      The source file or folder
@param string $strDestination The new file or folder path