# mkdir

makes a new directory

## Calling Sequence

                mkdir(dirname)
                mkdir(parentdir, dirname)
                status = mkdir( ... )
                [status, msg] = mkdir( ... )

## Arguments

dirname

  a character string: a directory to create.

parentdir

  a character string: a directory in which the new directory `dirname` will be created.

status

  an integer: the status of the operation.

msg

  a character string: a message about an error.

## Description

`mkdir(dirname)` creates the directory `dirname` in the current directory, if `dirname` represents a relative path. Otherwise, `dirname` represents an absolute path and `mkdir` attempts to create the absolute directory `dirname`.

`mkdir(parentdir, dirname)` creates the directory `dirname` in the directory `parentdir` (if `parentdir` is not existing it will be created), where `parentdir` is an absolute or relative pathname.

`[status,msg] = mkdir(parentdir, dirname)` creates the directory `dirname` in the existing directory `parentdir`, returning the status and the message about an error.

`status` | `msg`
-2 | mkdir: An error occurred: A file with the same name already exists in dirname
0 | mkdir: An error occurred: Impossible to create directory dirname
1 |
2 | mkdir: An error occurred: This directory already exists in dirname

Whatever the operating system, if the creating of directory succeeds, the `status` is 1 and the message `msg` is empty.

## Examples

    // Absolute pathname
    mkdir(TMPDIR+"/mkdir_example_1")
    status_2 = mkdir(TMPDIR+"/mkdir_example_2")
    [status_3,msg_3] = mkdir(TMPDIR+"/mkdir_example_3")

    // Absolute pathname (parentdir + dirname)
    [status_4,msg_4] = mkdir(TMPDIR,"mkdir_example_4")

    // Relative pathname
    cd TMPDIR;
    [status_5,msg_5] = mkdir("mkdir_example_5")
    [status_6,msg_6] = mkdir("mkdir_example_5/mkdir_example_6")

## See Also

- chdir
- dir
- rmdir