MkDir

System function.

The MkDir function creates a directory.

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/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$)