Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wildcard chars in file name

Status
Not open for further replies.

IlyaRabyy

Programmer
Nov 9, 2010
571
US
Colleagues,
What file-searching function/method in what class in .NET accepts wildcard chars in file names? Or directory names, for that matter?
The line like

Code:
File.Exists(lsFilePath & "*.ext")

always returns False...

Please advise.

Regards,

Ilya
 
To StrongM: tried it, got the following error:

2022_01_31_13_43_GetFiles_Errs_wxcsgv.jpg

Just in case, here's the code:
Code:
'The  call:
Dim lsFullPath As String = "C:\Ilya_Docs\Projects_and_Programs\VS_2019_Projects\ASCII_Text_Search\Resources\*.ico", lnCnt As Int32 = FindFiles(lsFullPath)
'The function
'====================================================================================================================================
Function FindFiles(ByVal tsFullPath As String) As Int32
'====================================================================================================================================
Dim llRet As Boolean = False, lnCnt As Int32 = 0

For Each lsFile As String In My.Computer.FileSystem.GetFiles(tsFullPath)
	lnCnt = lnCnt + 1
Next

Return lnCnt
End Function
'====================================================================================================================================
What might be wrong?
Please advise.

Regards,

Ilya
 
You need to be using the second overload: GetFiles(String, SearchOption, String[])

The documentation I linked to explains this
 
To StrongM: it works!
Thank you!
Problem's resolved, the case is being closed.


Regards,

Ilya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top