File.Exists alternative?

D

Dave Harris

Is there an alternate way to determine the existence of files other than
the File.Exists method. I have this code...

If File.Exists("tblm*.*") then
Kill("tblm*.*")
End If

The Kill method works fine with the asterisk as a placeholder but the
File.Exists method does not. I need some way to detect the presence of files
that all begin with tblm and then if there, delete them.
Any ideas? Thanks in advance!!

Dave
 
C

Chris Morse

Is there an alternate way to determine the existence of files other than
the File.Exists method. I have this code...

If File.Exists("tblm*.*") then
Kill("tblm*.*")
End If

The Kill method works fine with the asterisk as a placeholder but the
File.Exists method does not. I need some way to detect the presence of files
that all begin with tblm and then if there, delete them.
Any ideas? Thanks in advance!!

Dave

Try using something like this:

Imports System.IO

Dim szPath as String = Directory.GetCurrentDirectory()
If Directory.GetFiles("C:\TEMP", "tblm*.*").Length() > 0 Then
Kill("tblm*.*")
End If


// CHRIS
 

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