以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 遍历文件有问题,帮忙看下 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=64336) |
-- 作者:freeants -- 发布时间:2015/2/11 13:11:00 -- 遍历文件有问题,帮忙看下 PUBLIC _LST AS NEW LIST(OF STRING) 遍历函数名字 遍历文件 Dim str As String = Args(0) \'非末级目录 If str.Contains("RECYCLE") = False AndAlso str.Contains("System Volume Information") = False AndAlso str.Contains("WINDOWS\\Installer") = False AndAlso str.Contains("Microsoft\\Feeds") = False _ AndAlso str.Contains("Microsoft\\Installer") = False AndAlso str.Contains("Local Settings\\Temp") = False Then For Each s As String In FileSys.GetDirectories(str) If s.Contains("RECYCLE") = False AndAlso s.Contains("System Volume Information") = False AndAlso s.Contains("WINDOWS\\Installer") = False AndAlso s.Contains("Microsoft\\Feeds") = False _ AndAlso s.Contains("Microsoft\\Installer") = False AndAlso s.Contains("Local Settings\\Temp") = False Then _lst.Add(s) End If Next For Each s As String In FileSys.GetFiles(str) If s.Contains(".ldb") = False And s.Contains(".db") = False Then _lst.Add(s) End If Next If FileSys.GetDirectories(str).Count > 0 Then \'如果不为末级目录 Functions.Execute("遍历文件",str) \'再次循环 End If End If 一运行 就闪关 FT,不知道哪里有问题
|
-- 作者:逛逛 -- 发布时间:2015/2/11 13:36:00 -- 死循环了
Functions.Execute("遍历文件",str) \'再次循环
str 应该重新赋值
试试
Dim str As String = Args(0) \'非末级目录
If str.Contains("RECYCLE") = False AndAlso str.Contains("System Volume Information") = False AndAlso str.Contains("WINDOWS\\Installer") = False AndAlso str.Contains("Microsoft\\Feeds") = False _
AndAlso str.Contains("Microsoft\\Installer") = False AndAlso str.Contains("Local Settings\\Temp") = False Then
For Each s As String In FileSys.GetDirectories(str)
If s.Contains("RECYCLE") = False AndAlso s.Contains("System Volume Information") = False AndAlso s.Contains("WINDOWS\\Installer") = False AndAlso s.Contains("Microsoft\\Feeds") = False _
AndAlso s.Contains("Microsoft\\Installer") = False AndAlso s.Contains("Local Settings\\Temp") = False Then
_lst.Add(s)
Functions.Execute("遍历文件",s) \'再次循环
End If
Next
For Each s As String In FileSys.GetFiles(str)
If s.Contains(".ldb") = False And s.Contains(".db") = False Then
_lst.Add(s)
End If
Next
End If
|