Private Shared Function PathIsDirectory(ByVal path As String) As Boolean
Try
If Not System.IO.File.Exists(path) Then
Return IIf(((New System.IO.FileInfo(path).Attributes And System.IO.FileAttributes.Directory) = System.IO.FileAttributes.Directory),True,False)
End If
Catch generatedExceptionName As Exception
Return False
End Try
End Function