Creates a directory (and all its parent directories if neccessary)
Creates a directory (and all its parent directories if neccessary)
API Declarations
Dim fso As New FileSystemObject 'get this from Microsoft Scripting Run-time (scrrun.dll)
Rate Creates a directory (and all its parent directories if neccessary)
(2(2 Vote))
Private Sub CreateInstallDir()
CreateDir "c:\walter\dood\narj\rag\"
End Sub
'the actual function
Sub CreateDir(DirPath As String)
Dim CurDirs As New Collection
Dim i As Integer
i = 1
Do Until InStr(i, DirPath, "\", vbTextCompare) = 0
CurDirs.Add Left(DirPath, InStr(i, DirPath, "\", vbTextCompare))
i = InStr(i, DirPath, "\", vbTextCompare) + 1
Loop
For i = 1 To CurDirs.Count
If Not fso.FolderExists(CurDirs.Item(i)) Then
fso.CreateFolder CurDirs.Item(i)
End If
Next
End Sub
Creates a directory (and all its parent directories if neccessary) Comments
No comments yet — be the first to post one!
Post a Comment