我的目录结构如下。
- 目录 1 > subdir1_1 >((subdir1_1_1 >subdir1_1_1_1),subdir1_1_2)
目录2
两个主目录和 subdir1_1 有 2 个子目录(subdir1_1_1,subdir1_1_2)和 subdir1_1_1 有子目录“subdir1_1_1_1”
好的
现在我有这个代码
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim BaseFolder As New IO.DirectoryInfo(Me.TextBox1.Text)
For Each f As IO.DirectoryInfo In BaseFolder.GetDirectories()
AddContents(f)
Next
End Sub
Sub AddContents(ByVal BaseFolder As IO.DirectoryInfo)
For Each subF As IO.DirectoryInfo In BaseFolder.GetDirectories()
ListBox1.Items.Add(BaseFolder.FullName)
AddContents(subF)
Next
End Sub
End Class
和我的 textbox1.text="C:\test"
并且结果没有 subdir1_1_1_1 和 subdir1_1_2 。为什么 ??
哪里有问题??为什么我不能得到空文件夹? 在此处输入图像描述