core-bundle/src/Resources/contao/library/Contao/Files.php
public function rename($strOldName, $strNewName)
	{
		// Source file == target file
		if ($strOldName == $strNewName)
		{
			return true;
		}

		$this->validate($strOldName, $strNewName);

		// Windows fix: delete the target file
		if (\defined('PHP_WINDOWS_VERSION_BUILD') && file_exists($this->strRootDir . '/' . $strNewName) && strcasecmp($strOldName, $strNewName) !== 0)
		{
			$this->delete($strNewName);
		}

		// Unix fix: rename case sensitively
		if (strcasecmp($strOldName, $strNewName) === 0 && strcmp($strOldName, $strNewName) !== 0)
		{
			rename($this->strRootDir . '/' . $strOldName, $this->strRootDir . '/' . $strOldName . '__');
			$strOldName .= '__';
		}

		return rename($this->strRootDir . '/' . $strOldName, $this->strRootDir . '/' . $strNewName);
	}
public function rename($strOldName, $strNewName)
	{
		// Source file == target file
		if ($strOldName == $strNewName)
		{
			return true;
		}

		$this->validate($strOldName, $strNewName);

		// Windows fix: delete the target file
		if (\defined('PHP_WINDOWS_VERSION_BUILD') && file_exists($this->strRootDir . '/' . $strNewName) && strcasecmp($strOldName, $strNewName) !== 0)
		{
			$this->delete($strNewName);
		}

		// Unix fix: rename case sensitively
		if (strcasecmp($strOldName, $strNewName) === 0 && strcmp($strOldName, $strNewName) !== 0)
		{
			rename($this->strRootDir . '/' . $strOldName, $this->strRootDir . '/' . $strOldName . '__');
			$strOldName .= '__';
		}

		return rename($this->strRootDir . '/' . $strOldName, $this->strRootDir . '/' . $strNewName);
	}
Rename a file or folder

@param string $strOldName The old name
@param string $strNewName The new name

@return boolean True if the operation was successful