Foxtable(狐表)用户栏目专家坐堂 → [求助]递归-文件查找报错


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

主题:[求助]递归-文件查找报错

帅哥哟,离线,有人找我吗?
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2019/10/9 22:53:00 [显示全部帖子]

内部函数,函数名:递归,代码:

Dim path As String = args(0)
Dim ls As List(of String) = 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)
    Dim s As new System.Security.AccessControl.DirectorySecurity(p, System.Security.AccessControl.AccessControlSections.Access)
    If s.AreAccessRulesProtected = False Then
        Functions.Execute("递归", p, ls)
    End If
Next

调用测试:
Dim lst As new List(of String)
Functions.Execute("递归", "C:\foxtable\Development",lst)
MessageBox.show(lst.Count)

测试通过

 回到顶部