VB6SP6 Back again with question
I need to create a folder tree.
It can originate as
C:\Path1\Path2\Path3
or
\\Path1\Path2\Path3
The routine needs to be able to create any portion that does not already
exists.
MkDir or Dir does not seem to support the \\Path1\
I have a routine that uses Mkir and Dir, but only seems to work for non
\\Path\
' ====================
I ran across
Private Declare Function MakeSureDirectoryPathExists Lib "IMAGEHLP.DLL" _
(ByVal DirPath As String) As Long
bResult = MakeSureDirectoryPathExists(sPathIn)
but I am not sure if that is appropriate since what is IMAGEHLP.DLL?
' =======================
I tried working with
Private Type SECURITY_ATTRIBUTES
nLength As Long
lSecurityDescriptor As Long
bInheritHandle As Long
End Type
'
Private Declare Function CreateDirectory Lib "kernel32" Alias
"CreateDirectoryA" _
(ByVal lpPathName As String, _
lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long
'
Private Function CreateFolder(sFolder As String) As Boolean
On Error GoTo CreateFolderErr
Dim tSA As SECURITY_ATTRIBUTES
Dim lRet As Long
tSA.nLength = LenB(tSA)
' If the function succeeds, the return value is nonzero.
lRet = CreateDirectory(sFolder, tSA) ' returns zero on failure
CreateFolder = (lRet <> 0) ' true on success
CreateFolderExit:
Exit Function
CreateFolderErr:
Resume CreateFolderExit
End Function 'CreateFolder
Not sure how to deal with this since first I need to know how to check if
partial path is there. What do I use to check if partial path exists?