如果循环執行的話,文檔會一直重複。While 1
_filelist("c:")
WEnd
Func _filelist($searchdir)
$search = FileFindFirstFile($searchdir & "\*")
;~ msgbox(0,"1","2")
While 1
$file = FileFindNextFile($search)
If @error Then ;搜索完?
FileClose($search)
Return
ElseIf $file = "." Or $file = ".." Then ;如果文件名是本目?或者上?目?
ContinueLoop
ElseIf StringInStr(FileGetAttrib($searchdir & "" & $file), "D") Then ;如果搜索到的是子目?
_filelist($searchdir & "" & $file)
ContinueLoop ;不返回,下面?把".exe"?尾的目?也列?去
EndIf
If StringRight($file, 4) = ".jpg" Then ;??????,?于是找到文件了,匹配的?入列表文件
FileWriteLine(@ScriptDir&"\file.txt", $searchdir & "" & $file & @CRLF)
; FileCopy($searchdir & "" & $file,"f:\water")
EndIf
WEnd
EndFunc ;==>_filelist
|