Contao\Folder::copyTo PHP Method

copyTo() public method

Copy the folder
public copyTo ( string $strNewName ) : boolean
$strNewName string The target path
return boolean True if the operation was successful
    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;
    }