原文% Z+ l+ j2 G. f% w4 n/ F6 f
http://hi.baidu.com/chen_bawang/blog/item/598229385e1d6d26b8998fde.html, o% e2 G( f; ?+ G, }3 H0 h
; F7 V2 Y; I% h3 }: O7 K, k
我的环境是VB.Net2005
, W7 A- {" }3 g6 {; m6 _4 _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 |