原文7 q6 @- _4 P$ \, U l/ C2 S* n0 f1 i' K
http://hi.baidu.com/chen_bawang/blog/item/598229385e1d6d26b8998fde.html- v3 {9 q$ Q4 a! e% _; ]4 X3 h; W
, Y9 Y$ ^' b8 x' B$ C3 n' Z
我的环境是VB.Net2005; I& ?0 n9 k& P$ K& R& F# g% T
Public Class Form1 Private FilePath As String = "D:\程序\代码收藏" Private vbFilePath As String = "D:\程序\代码收藏\VB" Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TransFiles(vbFilePath) End Sub Private Sub TransFiles(ByVal strDirect As String) If Not (strDirect Is Nothing) Then Debug.Print("**********************************") Debug.Print(strDirect) Dim mFileInfo As System.IO.FileInfo Dim mDir As System.IO.DirectoryInfo Dim mDirInfo As New System.IO.DirectoryInfo(strDirect) For Each mFileInfo In mDirInfo.GetFiles() Debug.Print(mFileInfo.FullName) '你可以修改代码添加到你的数组中 Next For Each mDir In mDirInfo.GetDirectories TransFiles(mDir.FullName) Next End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TransFiles(vbFilePath) End Sub End Class |