Pastetool #136

URL: , Paste another

Public Function CreateDirectory(theDirectory As String) As Boolean
    On Error Resume Next
    Dim SL As Integer
    If InStr(1, theDirectory, ":\") <> 0 Then   'theDirectory contains 'Drive
        SL = InStr(1, theDirectory, "\")
        Do While SL <> 0
            MkDir Left$(theDirectory, SL)
            SL = InStr(SL + 1, theDirectory, "\")
        Loop
    Else
        If Left$(theDirectory, 1) <> "\" Then
            CreateDirectory CurDir$ & "\" & theDirectory
            Exit Function
        Else
            'Make SERVER directory
            SL = InStr(3, theDirectory, "\")
            If SL Then
                SL = InStr(SL + 1, theDirectory, "\")
            End If
            Do While SL <> 0
                MkDir Left$(theDirectory, SL)
                SL = InStr(SL + 1, theDirectory, "\")
            Loop
        End If
    End If
    
    If Right(theDirectory, 1) <> "\" Then
        MkDir theDirectory
    End If

    'Check if successful
    If isFolder(theDirectory) Then CreateDirectory = True
End Function

Download code

This visual basic code was pasted on January 7, 2010




Protected with advance Anti-SPAM techniques :)
Coded and designed by Fedmich
Follow us on Twitter