mkdir

from Wikipedia, the free encyclopedia

mkdir (abbreviation of English make directory , create directory ' ; sometimes md ) a command at is Unix-like systems as well as Windows , OS / 2 and DOS and in the scripting language PHP to create new directories to create.

use

mkdir Verzeichnisname

where stands Verzeichnisnamefor the directory to be created. If the command is executed in the normal console, the new folder is created starting from the current directory.

parameter

With Unixoid operating systems it has the mkdirfollowing parameters , among others:

  • -p: creates the directories if they do not already exist. If the directory already exists, no error is output and the process continues.
  • -v: outputs the created directories on the console, mostly used with -p.
  • -m: assigns the permissions to the directories that are specified as file permissions after the parameter in the octal value.

-pis mostly used to build mkdirmore complex file hierarchies, for example through Makefiles.

Examples

An example to -pis:

mkdir -p /tmp/a/b/c

If /tmp/aalready exists but /tmp/a/bnot, so created mkdir /tmp/a/bbefore /tmp/a/b/cadding.

It is also possible to create a complete tree:

mkdir -p tmpdir/{trunk/sources/{includes,docs},branches,tags}

If variables are used in a bash script, the 'eval' is required:

DOMAIN_NAME=includes,docs
eval "mkdir -p tmpdir/{trunk/sources/{${DOMAIN_NAME}},branches,tags}"

The following tree is created:

          tmpdir
    ________|______
   |        |      |
branches   tags  trunk
                   |
                 sources
               ____|_____
              |          |
          includes     docs

Web links