by Walter Eigner (15 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 12th April 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
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)
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
No comments have been posted about Creates a directory (and all its parent directories if neccessary). Why not be the first to post a comment about Creates a directory (and all its parent directories if neccessary).