Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27228

VS 2012 Getting filenames with a certain pattern

$
0
0
I need to get a list of filenames in a directory with a certain pattern. The files are named fileX.dat where X = a 1 or 2 digit number.
So for example, they could be called file1.dat or file10.dat. I can get just the single digit files like this:

Code:

Dim files() As String = (From file In New IO.DirectoryInfo(usePath).GetFiles Order By file.Name Where file.Name Like myFileName & "?" & myFileExt Select file.FullName).ToArray
I would like to get both the single & double digit files in one line of code. Can anyone help me out? Thanks...

Viewing all articles
Browse latest Browse all 27228

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>