dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Create multi directories?

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Create multi directories?

    [Originally posted by Tomas]

    Is it possible create a lot of directorys inside each other withone string?
    example (folders doesn't exist): "c\folder1\folder2\folder3\folder4\folder5"
    Folder1 - doesn't exist.
      Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Create multi directories?

    [Originally posted by neophile]

    This should do the trick...



    Public Sub MkPath(ByVal Path As String)
    Dim sFldr() As String
    Dim i As Integer
    Dim sPath As String
    If Mid(Path, 2, 2) = ":\" Then
    sFldr = Split(Path, "\")
    sPath = sFldr(0) & "\"
    For i = 1 To UBound(sFldr)
    If sFldr(i) <> "" Then
    sPath = sPath & sFldr(i) & "\"
    If Dir(sPath, vbDirectory) = "" Then MkDir sPath
    End If
    Next
    End If
    sPath = vbNullString
    Erase sFldr
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center