• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/file.php
  • Класс: CWebDavFile
  • Вызов: CWebDavFile::GetFilesAndFolders
function GetFilesAndFolders($path = false)
{
	$io = self::GetIo();
	if (!function_exists("__get_files_and_folders"))
	{
		function __get_files_and_folders($path, &$arSection)
		{
			static $io = false;

			if ($io === false)
				$io = CBXVirtualIo::GetInstance();

			if (!is_array($arSection))
				$arSection = array();

			$oDir = $io->GetDirectory($path);
			if ($oDir->IsExists())
			{
				$arSection[] = $path;
				$arChildren = $oDir->GetChildren();
				foreach($arChildren as $node)
				{
					$tmp_path = $node->GetPathWithName();
					$arSection[] = $tmp_path;

					if ($node->IsDirectory())
						__get_files_and_folders($tmp_path, $arSection);
				}
			}
			elseif ($io->FileExists($path))
			{
				$arSection[] = $path;
			}
		}
	}

	$result = array();

	if ($path)
	{
		//$path = $io->CombinePath($this->real_path_full, $path);
		$path = CWebDavBase::CleanRelativePathString($path, $this->real_path_full);
		if($path === false)
		{
			return false;
		}
		__get_files_and_folders($path, $result);
	}

	return $result;
}