Product Code Database
Example Keywords: grand theft -retro $32-189
   » » Wiki: Mkdir
Tag Wiki 'Mkdir'.
Tag

The mkdir ( ma ke directory) command in the , , , OS/2, Microsoft Windows, and is used to make a new directory. It is also available in the EFI shell and in the scripting language. In DOS, OS/2, Windows and ReactOS, the command is often abbreviated to '''md'''.

The command is analogous to the Stratus create_dir command. and provide a similar MakeDir command to create new directories.

(1988). 9781557550491, Grand Rapids, Mi : Abacus. .
The numerical computing environments and include an mkdir function with similar functionality.


History
In early versions of Unix (4.1BSD and early versions of ), this command had to be as the kernel did not have an mkdir . Instead, it made the directory with [[mknod]] and linked in the . and .. directory entries manually. The command is available in versions 2 and later.
(2026). 9780735618121, .
DR DOS 6.0 and also include an implementation of the and commands.

The version of mkdir bundled in was written by David MacKenzie. It is also available in the MS-DOS and in .


Usage
Normal usage is as straightforward as follows:

mkdir name_of_directory

where mkdir is the name of the directory one wants to create. When typed as above (i.e. normal usage), the new directory would be created within the current directory. On Unix and Windows (with Command extensions enabled, the default), multiple directories can be specified, and name_of_directory will try to create all of them.


Options
On Unix-like operating systems, mkdir takes options. The options are:
  • mkdir: parents or path, will also create all directories leading up to the given directory that do not exist already. For example, -p (--parents) will create directory mkdir -p a/b if it doesn't exist, then will create directory a inside directory b. If the given directory already exists, ignore the error.
  • a: mode, specify the octal permissions of directories created by -m (--mode) .
mkdir is most often used when using -p to build up complex directory hierarchies, in case a necessary directory is missing or already there. mkdir is commonly used to lock down temporary directories used by .


Examples
An example of -m in action is:

mkdir -p /tmp/a/b/c

If -p exists but /tmp/a does not, /tmp/a/b will create mkdir before creating /tmp/a/b.

And an even more powerful command, creating a full tree at once (this however is a Shell extension, nothing mkdir does itself):

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

If one is using variables with mkdir in a bash script, `special' built-in command 'eval' would serve its purpose.

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

This will create:

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


See also
  • Filesystem Hierarchy Standard
  • GNU Core Utilities
  • Find – The find command coupled with mkdir can be used to only recreate a directory structure (without files).
  • List of Unix commands
  • List of DOS commands


Further reading


External links

Page 1 of 1
1
Page 1 of 1
1

Account

Social:
Pages:  ..   .. 
Items:  .. 

Navigation

General: Atom Feed Atom Feed  .. 
Help:  ..   .. 
Category:  ..   .. 
Media:  ..   .. 
Posts:  ..   ..   .. 

Statistics

Page:  .. 
Summary:  .. 
1 Tags
10/10 Page Rank
5 Page Refs
1s Time