Contents

# MkDir Statement

데이터 매체에서 새 디렉토리를 만듭니다.

### Syntax:

    MkDir path

### Parameters:

path: Any string expression that specifies the name and path of the directory to be created. You can also use URL notation.

경로가 없을 경우 지정한 디렉토리가 현재 디렉토리에 만들어집니다.

### Error codes:

5 잘못된 프로시저 호출입니다.

76 경로를 찾을 수 없습니다.

### Example:

    Sub ExampleFileIO
    ' 파일 구조 함수를 위한 보기
    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,"새 파일 속성"
        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

Please support us!