Contents

# MkDir Statement

Kreira novi direktorij na mediju za podatke.

### 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.

Ako putanja nije određena, direktorij će biti kreiran unutar trenutačnog.

### Error codes:

5 Invalid procedure call

D'oh! You found a bug (text/sbasic/shared/00000003.xhp#err76 not found).

### Example:

    Sub ExampleFileIO
    Primjer za funkcije od organizacije dokumenata
    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 ' Da li direktorij postoji ?
            MkDir sSubDir1
            MsgBox sFile,0,"Napravi direktorij"
        End If
        sFile = sFile + "/" + sFile2
        FileCopy sFile1 , sFile
        MsgBox fSysURL(CurDir()), 0, "Trenutni direktorij"
        MsgBox sFile & Chr(13) & FileDateTime( sFile ),0,"Vrijeme kreiranja"
        MsgBox sFile & Chr(13)& FileLen(sFile), 0, "Dužina dokumenta"
        MsgBox sFile & Chr(13)& GetAttr(sFile), 0, "Atributi dokumenta"
        Name sFile As sDir1 + "/" + sSubDir1 + "/" + sFile3
        Preimenuje u istom direktoriju
        sFile = sDir1 + "/" + sSubDir1 + "/" + sFile3
        SetAttr( sFile, 0 ) 'Obriši sve atribute
        MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"Atributi novog dokumenta"
        Kill sFile
        RmDir sDir1 + "/" + sSubDir1
    End Sub

    Pretvara sistemsku putanju u URL-u
    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
        zapeta sa DOS
        iPos = Instr(1,fSysFp,":")
        If iPos > 0 Then Mid( fSysFp, iPos , 1,"|")
        fSysURL = "file://" & fSysFp
    End Function