core-bundle/src/Resources/contao/library/Contao/Folder.php
public function purge()
	{
		$this->Files->rrdir($this->strFolder, true);

		// Update the database
		if (Dbafs::shouldBeSynchronized($this->strFolder))
		{
			$objFiles = FilesModel::findMultipleByBasepath($this->strFolder . '/');

			if ($objFiles !== null)
			{
				while ($objFiles->next())
				{
					$objFiles->delete();
				}
			}

			Dbafs::updateFolderHashes($this->strFolder);
		}
	}
public function purge()
	{
		$this->Files->rrdir($this->strFolder, true);

		// Update the database
		if (Dbafs::shouldBeSynchronized($this->strFolder))
		{
			$objFiles = FilesModel::findMultipleByBasepath($this->strFolder . '/');

			if ($objFiles !== null)
			{
				while ($objFiles->next())
				{
					$objFiles->delete();
				}
			}

			Dbafs::updateFolderHashes($this->strFolder);
		}
	}
Purge the folder