#include <File.au3>
#include <Array.au3>
Local $sRootFolder = @ScriptDir & "\123"
Local $sOutputFile = @ScriptDir & "\iso_folders_found.txt"
FileDelete($sOutputFile)
Local $hFile = FileOpen($sOutputFile, 2)
If $hFile = -1 Then
MsgBox(0, "ошибка", "не найден: " & $sOutputFile)
Exit
EndIf
FileWriteLine($hFile, "Путь: " & $sRootFolder)
FileWriteLine($hFile, "Начало поиска: " & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
FileWriteLine($hFile, StringRepeat("=", 61))
FileWriteLine($hFile, "")
Local $iFoundCount = 0
$iFoundCount = SearchISOFolders($sRootFolder, $hFile)
FileWriteLine($hFile, "")
FileWriteLine($hFile, StringRepeat("=", 61))
FileWriteLine($hFile, "Завершено: " & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
FileWriteLine($hFile, "Найдено: " & $iFoundCount)
FileClose($hFile)
MsgBox(0, "Информация", "Найдено " & $iFoundCount & @CRLF & "Результаты: " & $sOutputFile)
Func StringRepeat($sString, $iCount)
Local $sResult = ""
For $i = 1 To $iCount
$sResult &= $sString
Next
Return $sResult
EndFunc
Func SearchISOFolders($sPath, $hOutputFile)
Local $iCount = 0
Local $hSearch = FileFindFirstFile($sPath & "\*")
If $hSearch = -1 Then Return 0
While 1
Local $sFile = FileFindNextFile($hSearch)
If @error Then ExitLoop
Local $sFullPath = $sPath & "\" & $sFile
If @extended Then
If StringRight(StringLower($sFile), 4) = ".iso" Then
If Not IsFolderEmpty($sFullPath) Then
FileWriteLine($hOutputFile, $sFullPath)
$iCount += 1
EndIf
EndIf
$iCount += SearchISOFolders($sFullPath, $hOutputFile)
EndIf
WEnd
FileClose($hSearch)
Return $iCount
EndFunc
Func IsFolderEmpty($sFolderPath)
Local $hSearch = FileFindFirstFile($sFolderPath & "\*")
If $hSearch = -1 Then Return True
Local $sFirstFile = FileFindNextFile($hSearch)
FileClose($hSearch)
If @error Then
Return True
Else
Return False
EndIf
EndFunc