File.exists

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

What is the correct syntax for checking for a file's existence based on it's
extension ?

Example:

Imports system.io
Dim path as string = "C:\myDirectory\*.txt"

then

If file.exists(path) then
msgBox("File exists")
end if

The *.txt is ignored.


Thanks for your help
 
Sorry I did not see this post but it answers my question.

question about file exists and wildcards
 
You could use this code:

string file[] = Directory.GetFiles("C:\myDirectory", "*.txt")

If your variable is not null, then you have your files :).

I hope it helps.
 
Back
Top