迭代器文件计数匹配和不匹配? [英] Iterator file count matches and non matches?

查看:104
本文介绍了迭代器文件计数匹配和不匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个递归文件系统迭代器,用于搜索多个文件扩展名.我有一个标签,用于对找到的匹配项进行计数,但是由于某种原因,我无法包含与文件计数不匹配的文件,因此我获得了完整的系统文件计数,而不仅仅是匹配项的计数.

对于匹配的文件,我希望进行一些计算,对于不匹配的文件,我希望进行计算.



I have a recrusive filesystem iterator that searches for multiple file extensions. I have a label that counts the matches found but for some reason I have been unable to include the files that do not match to the file count so that I get a full system file count and not just a count of the matches.

for the files that match I wish to do some calculations and for the ones that do not match I wish to just count.



Try
dim filespecs as string = "*.exe;*.com;*.386"
                Using fse As New FindFiles.FileSystemEnumerator(pathToSearchCombo.Text, filespecs, True)
                    Dim ien As IEnumerator(Of FileInfo) = fse.Matches().GetEnumerator()
                    ien.Dispose()
                    For Each fi As FileInfo In fse.Matches
Fcount = fcount +1
label3.text = fcount.tostring
''do some work

推荐答案

真的吗? FilesThatDontMatch = AllFiles-FileThatDoMatch

很明显,您必须在指定的路径中检索所有文件,然后找到匹配的文件.这样,您将拥有两个等式.
Really?? FilesThatDontMatch = AllFiles - FileThatDoMatch

It should be pretty obvious you have to retrieve ALL the files in the path specified, then find the ones that match. That way, you''ll have both pieces of the equation.


这篇关于迭代器文件计数匹配和不匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆