网管联盟 | 网管论坛 | 网管u家 | 网管博客 | 网管软件 | 网管求职 | 小游戏 | 网管搜索 | 网管原创 | 网管聚合 | 网管读摘 | 网管焦点 | 世界素材 | 会员投稿 | 会员中心 
中国网管联盟
Windows Linux Cisco 网络技术 数据库 黑客攻防 DotNet Java PHP 认证 新闻资讯 服务器 存储资讯 网络设备 网管学堂 技术专题 焦点 网吧频道
 当前位置: > bitsCN.com > DotNet > VB.NET > visual basic 6.0遍历文件夹下所有文件  

visual basic 6.0遍历文件夹下所有文件

2008-07-04  作者:bitsCN整理  来源:中国网管联盟  点评 投稿 收藏

        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 <> "." And item <> ".."  Then
                    If (GetAttr(FullPathName(sPath) & item) And vbDirectory) = vbDirectory Then
网管下载dl.bitscn.com

                        oPaths.Add item
                    Else
                        If IsModelFile(item) Then list.Add sPath & item
                    End If
                End If
                item = Dir
            Wend
            Dim p
            For Each p In oPaths

网管下载dl.bitscn.com


                Call GetAllFiles(Combin(sPath, p), list)
            Next
        End Function

网管联盟bitsCN@com

        判断文件夹后是否有

         Public Function FullPathName(ByVal strPath As String) As String
            FullPathName = IIf(VBA.Right(strPath, 1) = "\", strPath, strPath & "\")
        End Function

中国网管论坛bbs.bitsCN.com

        多个文件夹名组成路径

        Public Function Combin(ParamArray arg()) As String
            Dim X
            Dim result As String
            For Each X In arg()
                result = result & FullPathName(X)
            Next
            Combin = result
        End Function 网管bitscn_com

网管网www.bitscn.com

TAGs
 上一篇:vb.net中使用GetPrivateProfileString访问INI文件   下一篇:通过app.config来改变编译路径的问题
visual basic 6.0遍历文件夹下所有文件 评论:
loading.. 评论加载中…
评论:请自觉遵守互联网相关政策法规,评论不得超过250字。

验证码: 注册用户
本类热门排行:
最新推荐文章:
网管论坛交流: