Posted By

nimblebits on 07/07/13


basic directory exists visual DirectoryExists

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Check Folder Directory Exists Using VB.NET

 / Published in: VB.NET

I came across a permission issue when using the standard Directory.Exists() method, so I came up with another way to check if a Directory exists avoiding those permission issues. This works very well. It can be converted to C'#.

  1. Private Function DirectoryExists(ByVal sPath As String) As Boolean
  3. Try
  4. If System.IO.Directory.GetDirectories(sPath).Length > 0 Then
  5. Return True
  6. End If
  7. Catch ex As Exception
  8. Return False
  9. End Try
  11. Return False
  13. End Function

Report this snippet  

You need to login to post a comment.