No Opinions...just code

determine if a directory already exists, and create based on users input

    1 Public Shared Function VerifyDirectoryExists(ByVal path As String, ByVal create As Boolean) As Integer
    2 
    3     If My.Computer.FileSystem.DirectoryExists(Path) Then
    4         '{ directory already exists }
    5         Return 0
    6     Else
    7         If create = True Then
    8             '{ user want to create it }
    9             My.Computer.FileSystem.CreateDirectory(path)
   10             Return 0
   11         Else
   12             '{ directory doesnt exist and user doesnt want to create }
   13             Return 1
   14         End If
   15     End If
   16 
   17 End Function

0 comments: