IBM Lotus Symphony


MkDir 语句 [运行时]

在数据介质上创建一个新的目录。

语法:

MkDir Text As String

参数:

Text:指定要创建的目录的名称和路径的任何字符串表达式。您也可以使用 URL 表示法

如果未确定路径,那么会在当前目录中创建目录。

错误代码

5 无效的过程调用

76 未找到路径

示例:

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"

Loop Until sFile = ""

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


产品反馈 | 其他文档 | 商标