Checking for file existence

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

How can I check if a specific folder contains any dll (*.dll) files?

Thanks

Regards
 
One way is to check the Length on the returned array from
System.IO.Directory.GetFiles (path, pattern) method.

Hi

How can I check if a specific folder contains any dll (*.dll) files?

Thanks

Regards
 
Chad,

Chad Z. Hower aka Kudzu said:
System.IO.File.Exists()

This method can be used to determine if a certain file exists, but it does
not work with wildcards. As Siva suggests, I would use
'System.IO.Directory.GetFiles':

\\\
Imports System.IO
..
..
..
If Directory.GetFiles(Path, "*.dll").Length > 0 Then
...
Else
...
End If
///
 
Herfried K. Wagner said:
This method can be used to determine if a certain file exists, but it
does not work with wildcards. As Siva suggests, I would use
'System.IO.Directory.GetFiles':

Aah no - it wont. I didnt see the requirement for wildcards.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
 

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

Back
Top