Syntax
MkDir(<directory_name>)
or
ret = MkDir(<directory_name>)
Parameters
<directory_name>
: string, name of the directory to create.
Return Value
Ret, numeric return code. When the directory is successfully created, the function returns 0. Otherwise, use this return code for error handling.
Remarks
The function works the same as the DOS statement MKDIR, except it can create only one directory level at a time (see the examples).
See Also
RmDir
Examples
MkDir("c:\\docs")
MkDir(dir$)
MkDir("c:\\topdir")
MkDir("c:\\topdir\\subdir")
Example Code
The script below creates a directory based on date and hour:
' On C:\, we suppose that the directory paul is there.
' And four sub-directories AA, BB, CC, DD are under C:\paul.
' As an example, we retrieve the AA subdirectory name and under AA, we create
' a subdirectory c:\paul\AA\AA-date-hour
dim tablongname$(10)
dim tabshortname$(10)
dim tabpath$(10)
dim tabattrib$(10)
number_of_files = DirTree("c:\\paul\\*.*", tablongname$(), tabshortname$(), tabpath$(), tabattrib$(), "N")
cdate$ = month$() + day$() + "03"
ctime$ = hour$() + min$()
i = 0
MkDir("c:\\paul\\" + tablongname$(i) + "\\" + tablongname$(i) + "-" + cdate$ + "-" + ctime$)