LibreOfficeDev 25.8 Help
CPbSZ‖
ruXou‖Creates a new directory on a data medium.
83LPA‖MkDir path
qXfAs‖ path: Any string expression that specifies the name and path of the directory to be created. You can also use URL notation.
PLopZ‖If the path is not determined, the directory is created in the current directory.
Sub ExampleFileIO
KEaAA‖' Example for functions of the file organization
Const sFile1 As String = "file://c|/autoexec.bat"
Const sDir1 As String = "file://c|/Temp"
N8bbr‖Const sSubDir1 As String ="Test"
rnaAM‖Const sFile2 As String = "Copied.tmp"
CTKPw‖Const sFile3 As String = "Renamed.tmp"
Dim sFile As String
sFile = sDir1 + "/" + sSubDir1
ChDir( sDir1 )
vPDJc‖ If Dir(sSubDir1,16)="" Then ' Does the directory exist?
MkDir sSubDir1
JWAGf‖ MsgBox sFile,0,"Create directory"
End If
sFile = sFile + "/" + sFile2
FileCopy sFile1 , sFile
Gp5Yb‖ MsgBox fSysURL(CurDir()),0,"Current directory"
dosCS‖ MsgBox sFile & Chr(13) & FileDateTime( sFile ),0,"Creation time"
ENuMw‖ MsgBox sFile & Chr(13)& FileLen( sFile ),0,"File length"
DpF2g‖ MsgBox sFile & Chr(13)& GetAttr( sFile ),0,"File attributes"
Name sFile As sDir1 + "/" + sSubDir1 + "/" + sFile3
DnEhQ‖ ' Rename in the same directory
sFile = sDir1 + "/" + sSubDir1 + "/" + sFile3
SHhLB‖ SetAttr( sFile, 0 ) 'Delete all attributes
N5aXP‖ MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"New file attributes"
Kill sFile
RmDir sDir1 + "/" + sSubDir1
End Sub
uC9HY‖' 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
2ho3F‖ ' the colon with DOS
iPos = Instr(1,fSysFp,":")
If iPos > 0 Then Mid( fSysFp, iPos , 1,"|")
fSysURL = "file://" & fSysFp
End Function