原文7 s8 A) S( A+ N5 w' j' K$ C
http://hi.baidu.com/chen_bawang/blog/item/598229385e1d6d26b8998fde.html4 f# `4 V% p9 R0 {3 n
: L8 g4 y& V5 e' D1 I9 J1 O7 a& ]9 y
我的环境是VB.Net2005
# o' L" v9 ~( y" d0 Z0 f) hPublic 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 |