From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- .../source/text/sbasic/shared/03020411.xhp | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/03020411.xhp (limited to 'helpcontent2/source/text/sbasic/shared/03020411.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/03020411.xhp b/helpcontent2/source/text/sbasic/shared/03020411.xhp new file mode 100644 index 000000000..2051628f2 --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03020411.xhp @@ -0,0 +1,104 @@ + + + + + + + MkDir Statement + /text/sbasic/shared/03020411.xhp + + + + + + +
+ + MkDir statement + + + +

MkDir Statement

+ + MkDir Statement diagram + +Creates a new directory on a data medium. +
+ + + +MkDir path + + + + path: Any string expression that specifies the name and path of the directory to be created. You can also use URL notation. +If the path is not determined, the directory is created in the current directory. + + + + + + +Sub ExampleFileIO +' Example for functions of the file organization +Const sFile1 As String = "file://c|/autoexec.bat" +Const sDir1 As String = "file://c|/Temp" +Const sSubDir1 As String ="Test" +Const sFile2 As String = "Copied.tmp" +Const sFile3 As String = "Renamed.tmp" +Dim sFile As String + sFile = sDir1 + "/" + sSubDir1 + ChDir( sDir1 ) + If Dir(sSubDir1,16)="" Then ' Does the directory exist? + MkDir sSubDir1 + MsgBox sFile,0,"Create directory" + End If + sFile = sFile + "/" + sFile2 + FileCopy sFile1 , sFile + MsgBox fSysURL(CurDir()),0,"Current directory" + MsgBox sFile & Chr(13) & FileDateTime( sFile ),0,"Creation time" + MsgBox sFile & Chr(13)& FileLen( sFile ),0,"File length" + MsgBox sFile & Chr(13)& GetAttr( sFile ),0,"File attributes" + Name sFile As sDir1 + "/" + sSubDir1 + "/" + sFile3 + ' Rename in the same directory + sFile = sDir1 + "/" + sSubDir1 + "/" + sFile3 + SetAttr( sFile, 0 ) 'Delete all attributes + MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"New file attributes" + Kill sFile + RmDir sDir1 + "/" + sSubDir1 +End Sub + +' Converts a system path in URL +Function fSysURL( fSysFp As String ) As String +Dim iPos As String + iPos = 1 + iPos = Instr(iPos,fSysFp, getPathSeparator()) + Do While iPos > 0 + Mid( fSysFp, iPos , 1,"/") + iPos = Instr(iPos+1,fSysFp, getPathSeparator()) + Loop + ' the colon with DOS + iPos = Instr(1,fSysFp,":") + If iPos > 0 Then Mid( fSysFp, iPos , 1,"|") + fSysURL = "file://" & fSysFp +End Function + + + +
-- cgit v1.2.3