Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Hi All,
I have a set of files in a Specific folder, lets say Source = C:\Users\Shafiul Alam\Desktop\Hot Folder

But user don't now, the full file name but only a part of the file name(Numeric Number to the first "_")

Files as Below:
221452_1-173022-000-01_Indigo 5500-7600.mjm
21407_1-134335-092-00_Indigo 5500-7600.mjm
321407_1-134385-093-00_Indigo 5500-7600.mjm

In a TextBox User Need to input the Numeric number (example 221452 or 21407 or 321407) and Click, Msg Box will show the fullFileName with path or "No Such File"

Please help.
Posted
Comments
Richard MacCutchan 7-Jun-15 3:32am    
Since you did not mention which language you are using it is difficult to answer. But most have a function which can search for files using a wildcard path. Something like FindFirstFile in C/C++.
Shafiul Alam 7-Jun-15 3:44am    
I am sorry, its Visual Basic.Net, Not sure how to do that.

1 solution

try:
C#
string[] = Directory.GetFiles(@"C:\Users\Shafiul Alam\Desktop\Hot Folder", "221452" + "_*.*");
The array will contain the full path to all files starting with "221452_" in that folder.
 
Share this answer
 
Comments
Shafiul Alam 7-Jun-15 10:45am    
Thanks OriginalGriff
OriginalGriff 7-Jun-15 11:23am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900