MkDir Statement

MkDir Statement diagram

Luodaan uusi kansio tietovÀlineelle.

Syntaksi:


MkDir path

Parametrit:

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

Jos polkua ei mÀÀritetÀ, hakemisto luodaan nykyiseen kansioon.

Virhekoodit:

5 Virheellinen proseduurikutsu

76 Polkua ei löydy

Esimerkki:


Sub ExampleFileIO
' Esimerkki tiedostojÀrjestelmÀn funktioista
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 ' Onko kansio olemassa?
        MkDir sSubDir1
        MsgBox sFile,0,"Luodaan kansio"
    End If
    sFile = sFile + "/" + sFile2
    FileCopy sFile1 , sFile
    MsgBox fSysURL(CurDir()),0,"Avoin kansio"
    MsgBox sFile & Chr(13) & FileDateTime( sFile ),0,"Luomisajankohta"
    MsgBox sFile & Chr(13)& FileLen( sFile ),0,"Tiedoston koko"
    MsgBox sFile & Chr(13)& GetAttr( sFile ),0,"TiedostomÀÀreet"
    Name sFile As sDir1 + "/" + sSubDir1 + "/" + sFile3
    ' NimetÀÀn sama kansio uudestaan
    sFile = sDir1 + "/" + sSubDir1 + "/" + sFile3
    SetAttr( sFile, 0 ) 'Kaikki mÀÀritteet poistetaan
    MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"Uudet tiedostomÀÀreet"
    Kill sFile
    RmDir sDir1 + "/" + sSubDir1
End Sub
 
' Muunnetaan jÀrjestelmÀpolku URL:ksi
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
    ' kaksoispiste DOS:in kera
    iPos = Instr(1,fSysFp,":")
    If iPos > 0 Then Mid( fSysFp, iPos , 1,"|")
    fSysURL = "file://" & fSysFp
End Function

Please support us!