我改了一下,提取文件夹
内部函数,函数名:递归文件夹,代码:
Dim path As String = args(0)
Dim ls As List(of String) = args(1)
Dim s1 As String = args(2)
For Each file As String In FileSys.GetFiles(path)
If file.Contains(s1) Then
Dim finfo As new FileInfo(file)
If finfo.Hidden = False Then
Dim ifo As new FileInfo(file)
ls.add(ifo.Path)
End If
End If
Next
For Each p As String In FileSys.GetDirectories(path)
Dim s As new System.Security.AccessControl.DirectorySecurity(p, System.Security.AccessControl.AccessControlSections.Access)
If s.AreAccessRulesProtected = False Then
Functions.Execute("递归文件夹", p, ls, s1 )
End If
Next
测试:
Dim lst As new List(of String)
Dim s1 As String = e.Form.Controls("TextBox3").text
Functions.Execute("递归文件夹", "C:\foxtable\Development",lst,s1)
Dim xt As String
For Each nm As String In lst
xt = xt & "|" & nm
Next
MessageBox.show(xt)
测试通过
再排除重复OK