快捷搜索:  xxx  as  推理研究所  幼幼  侦探研究所

帝一娱乐登录手机版:visual basic 6.0遍历文件夹下所有文件



sPath是所查找的文件夹的路径,list是返回的文件列表

Public Function GetAllFiles(ByVal sPath As String, list As Collection)

Dim item As String

Dim oPaths As New Collection

item = Dir(sPath, vbDirectory)

While Len(item) > 0

If item".."Then

If (GetAttr(FullPathName(sPath) & item) And vbDirectory) = vbDirectory Then

oPaths.Add item

Else

If IsModelFile(item) Then list.Add sPa帝一娱乐登录手机版th & it帝一娱乐登录手机版em

End If

End If

item = Dir

Wend

Dim p

For Each p In oPaths

C帝一娱乐登录手机版all GetAllFiles(Combin(sPath, p), list)

Next

End Function

判断文件夹后是否有

Public Function FullPath帝一娱乐登录手机版Name(ByVal strPath As String) As String

FullPathName = IIf(VBA.Right(strPath, 1) = "\", strPath, strPath & "\")

End Function

多个文件夹名组成路径

Public Function Combin(ParamArra帝一娱乐登录手机版y arg()) As String

Dim X

Dim result As String

For Each X In arg()

result = result & FullPathName(X)

Next

Combin = result

End Function

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: