• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/file_temp.php
  • Класс: CTempFile
  • Вызов: CTempFile::_absolute_path_recursive_delete
static function _absolute_path_recursive_delete($path)
{
	if($path == '' || $path == '/')
		return false;

	$f = true;
	if(is_file($path) || is_link($path))
	{
		if(@unlink($path))
			return true;
		return false;
	}
	elseif(is_dir($path))
	{
		if($handle = opendir($path))
		{
			while(($file = readdir($handle)) !== false)
			{
				if($file == "." || $file == "..")
					continue;

				if(!CTempFile::_absolute_path_recursive_delete($path."/".$file))
					$f = false;
			}
			closedir($handle);
		}
		$r = @rmdir($path);
		if(!$r)
			return false;
		return $f;
	}
	return false;
}