原文6 q9 s( n/ ?! ^' D
http://hi.baidu.com/chen_bawang/blog/item/598229385e1d6d26b8998fde.html
2 q/ {7 W, M7 {% O7 s( D; z; b- N+ L& O- b% E' i1 a# g
我的环境是VB.Net2005
8 y. J# c/ B3 r5 d* ^0 Z, U2 OPublic 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 |