以下代码只能提取指定目录下的文件名,为什么不能提取其子目录下的文件名?代码哪有问题?
’提取文件按钮事件
Dim FilePath As WinForm.TextBox = e.Form.Controls("TextBox1")
If FileSys.DirectoryExists(FilePath.Value) Then
Functions.Execute("文件名提取函数",FilePath.value)
End If
‘自定义函数
Dim path As String = args(0)
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Sheet(0, 0).Value = "文件名"
Dim r As Integer = 1
For Each file As String In FileSys.GetFiles(path)
Dim Ifo As new FileInfo(file)
If Ifo.hidden=False Then
sheet(r,0).value = filesys.getname(file)
r += 1
End If
Next
For Each p As String In FileSys.GetDirectories(path)
Functions.Execute("文件名提取函数",p)
Next
Book.Save("c:\reports\test.xls")