---
name: "mkdirhier"
section: "1x"
platform: "linux"
package: "xutils"
version: "4.3.0.dfsg.1-14sarge7"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/mkdirhier/1x"
---

# mkdirhier(1x)

create a directory hierarchy

## NAME

mkdirhier - create a directory hierarchy

## SYNOPSIS

**mkdirhier** *directory* ...

## DESCRIPTION

**mkdirhier** creates the specified directories. Unlike some versions of **mkdir**, if any of the parent directories of the specified directory do not exist, **mkdirhier** creates them as well.

**mkdirhier** is a wrapper for **mkdir**; systems with [**mkdir**(1)](/mkdir/1.md) implementations conformant with the Single Unix Specification may simply use **mkdir -p** instead — this includes all systems using the GNU Core Utilities' version of **mkdir**.

## DIAGNOSTICS

If **mkdirhier** is not supplied with any arguments, a usage message is printed.

**mkdirhier** prefixes its diagnostic messages with the name under which it was invoked, followed by a colon (‘:’) so that its messages can be distingushed from others.

- **could not create directory "*directory*"**

  indicates that there was a failure while creating *directory*. This message will likely be preceded by a diagnostic message from **mkdir**.

## EXIT STATUS

- **64**

  **mkdirhier** was not given any directory names to create.

**mkdirhier** otherwise exits with the exit status of the last **mkdir** command that failed.

## BUGS

**mkdirhier** does not create all the requested directories as an atomic operation; therefore, it is is susceptible to race conditions. For example, if **mkdirhier** is directed to create a hierarchy *a/b/c/d* and any of *a/*, *b/*, or *c/* do not yet exist, any of the newly-created directories can be removed and/or replaced by a symbolic link to another location in the window of time after **mkdirhier** creates a directory and the directory immediately below it. This means that failures can be provoked (since **mkdir** will fail to create a directory in a directory that does not already exist), or directories may be created in unexpected locations. The same limitation holds for multiple directory arguments to **mkdirhier**; given two arguments *a/b/c/d* and *a/b/c/f*, it is possible for the directory hierarchy *a/b/c* to be disrupted in the time between the processing of the two arguments. To avoid these problems, use **mkdir -p** instead, or do not use **mkdirhier** to create directories in parts of the filesystem where untrusted users can manipulate them.

## SEE ALSO

[**mkdir**(1)](/mkdir/1.md)
