Func _GetDirsFilesList($sStartDirPath, $sFilesMask, $iAddFiles=1, $iAddDirs=0, $sRootPath=1) $sStartDirPath = StringRegExpReplace($sStartDirPath, '\\+$', '') Local $aRetArray[1], $aSubDirsArr, $sFindNextFile, $sCurrentPath, $iYesAdd Local $sFindFirstFile = FileFindFirstFile($sStartDirPath & '\' & $sFilesMask) If @error = 1 Then Return SetError(-1); нет искомых файлов If $sRootPath == 1 AND $iAddDirs == 1 Then $aRetArray[0] += 1 ReDim $aRetArray[2] $aRetArray[1] = $sStartDirPath EndIf While 1 $sFindNextFile = FileFindNextFile($sFindFirstFile) If @error = 1 Then ExitLoop $sCurrentPath = $sStartDirPath & '\' & $sFindNextFile $iYesAdd = 0 If StringInStr(FileGetAttrib($sCurrentPath), 'D') Then If $iAddDirs == 1 Then $iYesAdd = 1 Else If $iAddFiles == 1 Then $iYesAdd = 1 EndIf If $iYesAdd == 1 Then $aRetArray[0] += 1 ReDim $aRetArray[$aRetArray[0]+1] $aRetArray[$aRetArray[0]] = $sCurrentPath EndIf $aSubDirsArr = _GetDirFilesList($sCurrentPath, $sFilesMask, $iAddFiles, $iAddDirs, 0) If IsArray($aSubDirsArr) Then For $i = 1 To $aSubDirsArr[0] $aRetArray[0] += 1 ReDim $aRetArray[$aRetArray[0]+1] $aRetArray[$aRetArray[0]] = $aSubDirsArr[$i] Next EndIf WEnd FileClose($sFindFirstFile) SetError(0) Return $aRetArray EndFunc |