我在一个目录下面怎么动态的读取目录下面的下一级目录

解决方案 »

  1.   

    Directory.GetDirectories() 得到所有目录里面的子目录具体看看MSDN很详细的
      

  2.   

    vb.net的,你自己改了Private Sub GetFiles(ByVal dir As DirectoryInfo)
            Dim iTotalLen As Integer = 0
            Dim subDirs As DirectoryInfo() = dir.GetDirectories
            For Each subdir As DirectoryInfo In subDirs
                GetFiles(subdir)
            Next        Dim fls As FileInfo() = dir.GetFiles
            For Each fi As FileInfo In fls
                If fi.FullName.Substring(fi.FullName.Length - 4, 4) = ".sql" Then
                    Dim myfile As System.IO.StreamReader = New System.IO.StreamReader(fi.FullName)
                    Dim strTemp As String = myfile.ReadToEnd
                    myfile.Close()
                    Me._sb.Append(strTemp)
                End If
            Next
        End Sub动态读取指定目录的所有下级目录