VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Dir Maker

by enmity (9 Submissions)
Category: VB function enhancement
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

Make any level directories, such as:
MakeDir "c:\abc\1234\aaaa\1111\6666\ggggggggg\dddddddddd\ssssssss\7676\dsdsds"

Rate Dir Maker

Public Function MakeDir(Path As String) As Boolean
On Error Resume Next    
    
    Dim o_strRet As String
    Dim o_intItems As Integer
    Dim o_vntItem As Variant
    Dim o_strItems() As String
    
    o_strItems() = Split(Path, "\")
    o_intItems = 0
    For Each o_vntItem In o_strItems()
      o_intItems = o_intItems + 1
      If o_intItems = 1 Then
        o_strRet = o_vntItem
      Else
        o_strRet = o_strRet & "\" & o_vntItem
        MkDir o_strRet
      End If
    Next
    
    MakeDir = (Err.Number = 0)
    
End Function

Download this snippet    Add to My Saved Code

Dir Maker Comments

No comments have been posted about Dir Maker. Why not be the first to post a comment about Dir Maker.

Post your comment

Subject:
Message:
0/1000 characters