File.exists

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
 
G

Guest

Sorry I did not see this post but it answers my question.

question about file exists and wildcards
 
R

Robson Siqueira

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top