MkDir Statement

āĻāĻ•āϟāĻŋ āĻĄāĻžāϟāĻž āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ āύāϤ⧁āύ āĻāĻ•āϟāĻŋ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀ āϤ⧈āϰāĻŋ āĻ•āϰāĻž āĻšā§ŸāĨ¤

āϏāĻŋāύāĻŸā§āϝāĻžāĻ•ā§āϏ:

MkDir Text As String

āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāϟāĻžāϰ:

āϞ⧇āĻ–: āϝ⧇āϕ⧋āύ⧋ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āĻāĻ•ā§āϏāĻĒā§āϰ⧇āĻļāύ āϝāĻžāϤ⧇ āϤ⧈āϰāĻŋ āĻ•āϰāĻž āĻšāĻŦ⧇ āĻāĻŽāύ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋāϰ āύāĻžāĻŽ āĻāĻŦāĻ‚ āĻĒāĻžāĻĨ āωāĻ˛ā§āϞ⧇āĻ– āĻĨāĻžāϕ⧇āĨ¤ āφāĻĒāύāĻŋ URL āύ⧋āĻŸā§‡āĻļāύāĻ“ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāϤ⧇ āĻĒāĻžāϰ⧇āύāĨ¤

āϝāĻĻāĻŋ āĻāĻ•āϟāĻŋ āĻĒāĻžāĻĨ āύāĻŋāĻ°ā§āϧāĻžāϰāĻŋāϤ āύāĻž āĻĨāĻžāϕ⧇ āϤāĻžāĻšāϞ⧇ āĻŦāĻ°ā§āϤāĻŽāĻžāύ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋāϤ⧇ āĻāχ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋāϟāĻŋ āϤ⧈āϰāĻŋ āĻšāĻŦ⧇āĨ¤

Error codes:

5 Invalid procedure call

76 Path not found 76 Path not found 76 Path not found

āωāĻĻāĻžāĻšāϰāĻŖ:

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

    ' āĻāĻ•āχ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰ⧀āϤ⧇ āĻĒ⧁āύāϰāĻžāϝāĻŧ āύāĻžāĻŽāĻ•āϰāĻŖ āĻ•āϰ⧁āύ

    sFile = sDir1 + "/" + sSubDir1 + "/" + sFile3

    SetAttr( sFile, 0 ) 'āϏāĻŦ āĻŦ⧈āĻļāĻŋāĻˇā§āĻŸā§āϝ āĻŽā§āϛ⧇ āĻĢ⧇āϞāĻž āĻšā§Ÿ

    MsgBox sFile & Chr(13) & GetAttr( sFile ),0,"New file attributes"

    Kill sFile

    RmDir sDir1 + "/" + sSubDir1

End Sub

 

' 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

    ' DOS āĻŦāĻŋāĻļāĻŋāĻˇā§āϟ āϕ⧋āϞāύ

    iPos = Instr(1,fSysFp,":")

    If iPos > 0 Then Mid( fSysFp, iPos , 1,"|")

    fSysURL = "file://" & fSysFp

End Function