Home > Language Reference > System Functions > MkDir

MkDir

The MkDir function creates a folder.

Usage

Used to create a folder.

Syntax

ret = MkDir(<folder_name>)

Parameters

<folder_name>. string, name of the folder to create. Only one folder level can be created.

Return value

ret, optional integer return value. If the folder is successfully created, the return value is 0. If the function fails, the return value is a nonzero value (see System Functions Error Codes).

See also

RmDir

Examples

MkDir("c:\docs")
MkDir(dir$)

MkDir("c:\topdir")
MkDir("c:\topdir\subdir")



'The script below creates a directory based on date/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$)