The SHCreateDirectoryEx API can make multiple sub folders in one call and won't error if the folder already exists, might want to try something like this,
Code:Option Explicit 'SHCreateDirectoryEx - Minimum operating systems: Windows 2000, Windows Millennium Edition Private Declare Function SHCreateDirectoryEx Lib "shell32" Alias "SHCreateDirectoryExA" (ByVal hwnd As Long, ByVal pszPath As String, ByVal psa As Any) As Long Private Sub createfolders() Dim sPath As String Open "C:\config\folders.dat" For Input As #1 Do Until EOF(1) Line Input #1, sPath sPath = Trim$(sPath) If Len(sPath) > 0 Then SHCreateDirectoryEx Me.hwnd, sPath, ByVal 0& Loop Close #1 End Sub




Reply With Quote