惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
D
Docker
H
Help Net Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
C
Check Point Blog
S
SegmentFault 最新的问题
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
M
MIT News - Artificial intelligence
B
Blog RSS Feed
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
美团技术团队
I
InfoQ
Blog — PlanetScale
Blog — PlanetScale

博客园 - IT 笔记

Subversion Revert File will not be shown in Modification Surprise vb.net WinForm don't require instance to access the instance value Properties.Settings show error 'System.Windows.Forms.PropertyStore' does not contain a definition for 'Settings' Add Image in MS Report RDLC by using Embedded Image 王爽汇编 Lab 13 Question 1, 用两个程序实现 Spring.NET Installation and setup the first program 王爽汇编语言 实验11 王爽汇编语言 检测点11.2 王爽 汇编语言程序课程设计1 王爽 汇编语言程序设计实验10,题三,数值转换。(Assembly experiment Convert HEX to Decimal and Show on screen ) 王爽 汇编语言程序设计 实验9 (Assembly Language Study) 王爽 汇编语言程序设计 检测点9.1 第2题 The NTVDM CPU has encountered an illegal instruction. CS:0006 IP:130a .... Access Denied when running Spring.IocQuickStart.MovieFinder using vb.net read unix style text file How to install autotrace in fontforge My first postscript program .net 2 config A generic winform skeleton support interactive UI during large job process
select files by multiple extension name
IT 笔记 · 2011-02-04 · via 博客园 - IT 笔记

The default selectfile's selectpattern only support on exention name.

For example,  command below can only retrieve jpg image.

If you want both jpg and gif, you need two clause and combine the outputs.  

System.IO.Directory.GetFiles("F:\""*.jpg", IO.SearchOption.AllDirectories)

Alternatively, you can use LINQ and regular expression like below, but the code has issue when image has two extension like "Signature.jpg.pfs". Need a bit more works on the regular expression.

If someone knows how to write the regular expression, please let me know. Thanks 

代码

Private Sub loadFiles() 
        
For Each afile In SelectFilesWithExtenstions("F:\Learning\LoadDistinctFileInCheckListBox\file"".jpg|.png|.gif")
            Debug.Print(afile.name)
        
Next
    
End SubPrivate Function SelectFilesWithExtenstions(ByVal folder As StringByVal extensions As String
        
Dim dir As New System.IO.DirectoryInfo(folder)
        
Dim fileList = dir.GetFiles("*.*", System.IO.SearchOption.AllDirectories)
        
Dim searchExtenstions As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex((extensions))
        
Dim queryGroupByExt = From afile In fileList _
                                Let matches 
= searchExtenstions.Matches(afile.FullName) _
                                Where (searchExtenstions.Matches(afile.FullName).Count 
> 0) _
                                
Select Name = afile.FullName, _
                                Matches 
= From match As System.Text.RegularExpressions.Match In matches _
                                
Select match.Value
        
Return queryGroupByExt
    
End Function