Jedoch musst du sicherstellen, daß das Verzeichniss, indem du den Ordner erstellen willst bereits existiert.
z.B. C:\Temp\Test kann nicht erstellt werden wenn C:\Temp nicht existiert. In diesem Falle musst du erst prüfen, ob das Zielverzeichnis da ist und ggf. erstellen.
Ich mach das immer über das FileSystemObject:
Sub CreateFolder(str_path as String)
Dim str_drive As String
Dim str_tmppath As String
On Error ErrNoPlatSupport Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
If Err = ErrNoPlatSupport Then Err = 0
If Not (Isempty(fso)) Then
' type of drive
If Not Left(str_path,2) = "\\" Then
If Not fso.DriveExists(Strleft(str_path,"\") & "\") Then Exit sub
str_drive = Strleft(str_path,"\") & "\"
Else
str_drive = "\\" & Strleft(Strright(str_path,"\\"),"\") & "\"
End If
' create folder
str_tmppath = Strright(str_path,str_drive)
Do Until Instr(str_tmppath,"\") = 0
str_drive = str_drive & Strleft(str_tmppath,"\") & "\"
str_tmppath = Strright(str_path,str_drive)
If Not fso.FolderExists(str_drive) Then Call fso.CreateFolder(str_drive)
Loop
str_drive = str_drive & str_tmppath
If Not fso.FolderExists(str_drive) Then Call fso.CreateFolder(str_drive)
End If
End Sub
Eat this: ;)
Function CreateFolder(str_path As String) As Boolean
Dim str_separator As String
Dim s As NotesSession
Dim str_tmppath As String
Dim int_pos As Integer
Dim int_begin As Integer
CreateFolder = False
Set s = New NotesSession
Select Case s.Platform
Case "Windows/16", "Windows/32": str_separator = "\"
Case Else: str_separator = "/"
End Select
int_begin = 1
str_tmppath = str_path
Do
int_pos = Instr(int_begin, str_path, str_separator)
If (int_pos = 0) Then
str_tmppath = str_path
Else
str_tmppath = Left$(str_path, int_pos - 1)
End If
If (Len(Dir$(str_tmppath, ATTR_DIRECTORY)) = 0) Then
On Error Resume Next
Mkdir str_tmppath
If Err > 0 Then
Err = 0
Exit Function
End If
End If
int_begin = int_pos + 1
Loop While(int_pos > 0)
CreateFolder = True
End Function
Bernhard, das würde mich jetzt auch interessieren, wie Du das "pure LS" löst.
Zumal auch die Help zu MkDir meint:
Use the path syntax for the platform on which you are running LotusScript.
Danke.