-
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
-
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
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|