自定义函数-递归
Dim path As String = args(0)
Dim ls = args(1)
For Each file As String In FileSys.GetFiles(path)
Dim finfo As new FileInfo(file)
If finfo.Hidden = False Then
ls.add(file)
End If
Next
For Each p As String In FileSys.GetDirectories(path)
Functions.Execute("递归", p, ls)
Next
---------------
按钮-查找
'''
e.Form.Controls("TextBox1").text = "" '先清空
e.Form.Controls("TextBox1").text = "文件查找中......"
Dim count As Integer = 0 '设置计数器
Dim str As String = ""
Dim path As String = e.Form.Controls("TextBox2").text '文件夹路径
Dim s1 As String = e.Form.Controls("TextBox3").text '文件名关键字
If path = "" Then
msgbox("请获取文件夹路径!")
Else
If s1 <> "" Then
Dim stt As Date = Date.Now '开始计时
Dim lst1 As new List(Of String)
Functions.Execute("递归" ,path , lst1)
For Each nm As String In lst1
If s1 <> "" AndAlso nm.Contains(s1) Then
str &= FileSys.GetName(nm) & vbcrlf
count += 1
End If
Next
e.Form.Controls("TextBox1").text = "文件查找完毕!" & vbcrlf & "共查找到文件" & count & "个," & "耗时:" & (Date.Now - stt).TotalSeconds & "秒," & vbcrlf & vbcrlf & str
End If
End If