public function copyTo($strNewName)
{
$strParent = dirname($strNewName);
// Create the parent folder if it does not exist
if (!is_dir(TL_ROOT . '/' . $strParent)) {
new \Folder($strParent);
}
$this->Files->rcopy($this->strFolder, $strNewName);
// Update the database AFTER the folder has been renamed
$syncSource = \Dbafs::shouldBeSynchronized($this->strFolder);
$syncTarget = \Dbafs::shouldBeSynchronized($strNewName);
if ($syncSource && $syncTarget) {
\Dbafs::copyResource($this->strFolder, $strNewName);
} elseif ($syncTarget) {
\Dbafs::addResource($strNewName);
}
return true;
}