取文件夹下的所有子目录

Public Sub HaalDirOp(ByVal Path$)
    Dim vDirName As String, LastDir As String

    Screen.MousePointer = vbHourglass
    If Right(Path$, 1) <> "\" Then Path$ = Path$ & "\"
    vDirName = Dir(Path, vbDirectory) ' Retrieve the first entry.
    Do While Not vDirName = ""
        If vDirName <> "." And vDirName <> ".." Then
            If (GetAttr(Path & vDirName) And vbDirectory) = vbDirectory Then
                LastDir = vDirName

                Debug.Print vDirName

                Call HaalDirOp(Path$ & vDirName)

                vDirName = Dir(Path$, vbDirectory)
                Do Until vDirName = LastDir or vDirName = ""
                    vDirName = Dir
                Loop
                If vDirName = "" Then Exit Do
            End If
        End If
        vDirName = Dir
    Loop
    Screen.MousePointer = vbNormal
End Sub

Private Sub Form_Load()
    HaalDirOp ("D:\Thunder5")
End Sub



'引用http://www.chinavb.net/Article.Asp?id=300


文章来自: 本站原创
引用通告地址: http://www.is21.cn/trackback.asp?tbID=332
Tags:
评论: 0 | 引用: 0 | 查看次数: 1742
发表评论
你没有权限发表留言!