本帖最后由 user3000 于 2012-1-10 14:25 编辑
一个循环就够了
Local $Totle_count = 0, $jpg_count = 0, $png_count = 0, $bmp_count = 0, $tif_count = 0
Local $hSearch = FileFindFirstFile("C:\WINDOWS\*.*")
; 检查搜索是否成功
If $hSearch = -1 Then
MsgBox(0, "错误", "没有文件/目录 匹配搜索")
Exit
EndIf
While 1
$File = FileFindNextFile($hSearch)
If @error Then ExitLoop
Switch StringRight($File, 3)
Case 'jpg'
$jpg_count += 1
$Totle_count += 1
Case 'png'
$png_count += 1
$Totle_count += 1
Case 'bmp'
$bmp_count += 1
$Totle_count += 1
Case 'tif'
$tif_count += 1
$Totle_count += 1
EndSwitch
WEnd
FileClose($hSearch)
MsgBox(4096, "找到匹配图片文件数", '总数: ' & $Totle_count & @CRLF & _
'其中: ' & @CRLF & 'jpg: ' & $jpg_count & @CRLF & 'png: ' & $png_count & @CRLF & _
'bmp: ' & $bmp_count & @CRLF & 'tif: ' & $tif_count)
|