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


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

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

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


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/10/6 20:55:00 [显示全部帖子]

函数没有问题。有些系统隐藏目录没有权限读取的

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


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/10/6 21:43:00 [显示全部帖子]


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


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/10/8 22:11:00 [显示全部帖子]

"递归"函数的代码?

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


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/10/13 23:05:00 [显示全部帖子]

哪应该在递归里面判断

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

Dim path As String = args(0)
Dim ls As List(of String) = args(1)
Dim s1 As List(of 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
        ls.add(file)
    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)
    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)
MessageBox.show(lst.Count)

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


加好友 发短信
等级:超级版主 帖子:106732 积分:542855 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/11/3 20:39:00 [显示全部帖子]

没看懂,如果不需要看子目录,还做什么递归?直接一个for循环就可以了

 回到顶部