搜索文件夹中某类型文件及其所在的子文件夹名
请教:搜索一个文件夹中某个类型的文件,并返回该文件及该文件所在的子文件夹名
小弟只知道搜索一个文件夹下某一类型的文件的函数:
_FileListToArray("","*.exe")
[ 本帖最后由 qqgghh1 于 2008-8-27 11:55 编辑 ] $path = "D:\jhwl"
$type = ".exe"
_filelist($path)
Func _filelist($searchdir)
$search = FileFindFirstFile($searchdir & "\*.*")
If $search = -1 Then Return -1
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)
EndIf
If StringRight($file, 4) = $type Then
MsgBox(0,"JHWL","当前搜索类型文件:"&$searchdir & "\" & $file)
EndIf
WEnd
EndFunc ;==>_filelist jhwl真是热心人.参考了你的,问题解决了.太谢谢了. jhwl,我要顶你一下.:face (14): 多谢,我正好需要这个功能。太感谢jhwl了 这个很好用的~ 路过,学习中…… _filelist($path) 是搜索 ¥path下的所有文件 吧?
ElseIf $file = "." Or $file = ".." Then
ContinueLoop
但这个不懂呀 求解……".",".."代表什么呢? 多谢,很有帮助,{:face (270):}
页:
[1]