VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Determine if a directory exists

by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Mon 28th December 1998
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Determine if a directory exists

Rate Determine if a directory exists



' FUNCTION: DirExists
'
' Determines whether the specified directory name exists.
' This function is used (for example) to determine whether
' an installation floppy is in the drive by passing in
' something like 'A:\'.
'
' IN: [strDirName] - name of directory to check for
'
' Returns: True if the directory exists, False otherwise

'
Public Function DirExists(ByVal strDirName As String) As Integer

    Dim strDummy As String

    On Error Resume Next

    If Right$(strDirName, 1) <> "\" Then
        strDirName = strDirName & "\"
    End If

    strDummy = Dir$(strDirName & "*.*", vbDirectory)
    DirExists = Not (strDummy = vbNullString)

    Err = 0
End Function

Download this snippet    Add to My Saved Code

Determine if a directory exists Comments

No comments have been posted about Determine if a directory exists. Why not be the first to post a comment about Determine if a directory exists.

Post your comment

Subject:
Message:
0/1000 characters