Turinys
Rodyklė 🔎︎

# MkDir sakinys

Duomenų laikmenoje sukuriamas naujas katalogas.

## Syntax:

    MkDir Text As String

## Parameters:

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

Jei kelias nenustatytas, katalogas kuriamas dabartiniame kataloge.

### Klaidos kodai:

5 Neteisingas procedūros iškvietimas

75 adresas nerastas

## Example:

    Sub ExampleFileIO
    ' Failų organizacijos funkcijų pavyzdys
    Const sFile1 As String = "file://c|/autoexec.bat"
    Const sDir1 As String = "file://c|/Temp"
    Const sSubDir1 As String ="Testas"
    Const sFile2 As String = "nukopijuota.tmp"
    Const sFile3 As String = "pervadinta.tmp"
    Dim sFile As String
        sFile = sDir1 + "/" + sSubDir1
        ChDir( sDir1 )
        If Dir(sSubDir1,16)="" Then ' Ar yra katalogas?
            MkDir sSubDir1
            MsgBox sFile,0,"Sukurti katalogą"
        End If
        sFile = sFile + "/" + sFile2
        FileCopy sFile1 , sFile
        MsgBox fSysURL(CurDir()),0,"Dabartinis katalogas"
        MsgBox sFile & Chr(13) & FileDateTime( sFile ),0,"Sukūrimo laikas"
        MsgBox sFile & Chr(13)& FileLen( sFile ),0,"Failo ilgis"
        MsgBox sFile & Chr(13)& GetAttr( sFile ),0,"Failo atributai"
        Name sFile As sDir1 + "/" + sSubDir1 + "/" + sFile3
        ' Pervardykite tame pačiame kataloge
        sFile = sDir1 + "/" + sSubDir1 + "/" + sFile3
        SetAttr( sFile, 0 ) 'Ištrinti visus atributus
        MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"Nauji failo atributai"
        Kill sFile
        RmDir sDir1 + "/" + sSubDir1
    End Sub

    ' Konvertuoja sistemos kelią į 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
        ' dvitaškis naudojant DOS
        iPos = Instr(1,fSysFp,":")
        If iPos > 0 Then Mid( fSysFp, iPos , 1,"|")
        fSysURL = "file://" & fSysFp
    End Function