Foxtable(狐表)用户栏目专家坐堂 → [求助]遍历文件夹下级的所有文件?


  共有3377人关注过本帖树形打印复制链接

主题:[求助]遍历文件夹下级的所有文件?

帅哥哟,离线,有人找我吗?
2425004926
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:712 积分:5553 威望:0 精华:0 注册:2019/11/14 9:36:00
  发帖心情 Post By:2021/3/25 15:37:00 [只看该作者]

 我改了一下,提取文件夹

内部函数,函数名:递归文件夹,代码:
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

 回到顶部
帅哥哟,离线,有人找我吗?
FOTOER
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:154 积分:1523 威望:0 精华:0 注册:2011/8/29 20:48:00
  发帖心情 Post By:2021/10/25 11:29:00 [只看该作者]

学习一下

 回到顶部
总数 12 上一页 1 2