遍历效率好慢
#include <file.au3>
#include <array.au3>
Global $aArray[1], $Num = 0, $aDISK
Global $aFileList, $InstallDir, $aFilePath, $str, $aQQ
$aDISK = DriveGetDrive("ALL")
If Not @error Then
For $I = 1 To $aDISK[0]
If DriveStatus($aDISK[$I]) = "READY" And $aDISK[$I] <> @HomeDrive Then _SEARCH($aDISK[$I], "QQ.EXE")
If UBound($aArray) > 1 Then
For $j = 1 To UBound($aArray) - 1
$aFilePath = StringRegExp($aArray[$j], ".+(?=\\)", 3)
If IsArray($aFilePath) Then $InstallDir = $aFilePath[0] & "\Users"
If FileExists($InstallDir) Then $aFileList = _FileListToArray($InstallDir)
If IsArray($aFileList) Then $str = _ArrayToString($aFileList, "|")
$aQQ = StringRegExp($str, "\d{5,15}", 3)
_ArrayDisplay($aQQ, "QQ号码")
Next
ExitLoop
EndIf
Next
EndIf
Func _SEARCH($path, $filelx)
Local $filelist
Local $folders
Local $I, $j, $newpath
$filelist = _FileListToArray($path, $filelx, 1)
If Not @error Then
If $filelist[0] > 0 Then
For $I = 1 To $filelist[0]
$Num = $Num + 1
ReDim $aArray[UBound($aArray) + 1]
$aArray[$Num] = $path
Next
EndIf
EndIf
$folders = _FileListToArray($path, "*", 2)
If Not @error Then
If $folders[0] > 0 Then
For $j = 1 To $folders[0]
$newpath = $path & "\" & $folders[$j]
_SEARCH($newpath, $filelx)
Next
EndIf
EndIf
EndFunc ;==>_SEARCH
|