Back to Blog
Arnošt Havelka

Creating Directories with mkdir

Master mkdir to create single and nested directory structures.

Start Interactive Lesson
Creating Directories with mkdir

Creating Directories with mkdir

The mkdir command creates directories (folders). It's the foundation of file organization.

Create a Single Directory

Use mkdir followed by a directory name to create one folder.

Usage:mkdirdirname
mkdir
Make Directory - creates a new directory with the specified name.

Create a folder:

Command Prompt
Documents Pictures
C:\Users\User>ls

Create Nested Directories: mkdir -p

The -p flag creates parent directories as needed. Perfect for building entire folder structures at once.

Usage:mkdir-pparent/child/grandchild
-p
Parents - creates parent directories as needed if they don't exist.

Build structures instantly:

Command Prompt
existing_folder
C:\Users\User>ls

Create Multiple Directories

Create several folders at the same level with one command.

Usage:mkdirdir1 dir2 dir3
dir1 dir2 dir3
Multiple directories - creates all of them in the current location.

Batch directory creation:

Command Prompt
C:\Users\User>ls

Knowledge Check

1 / 3

What does mkdir do?

References

These Microsoft Learn and Windows documentation links provide authoritative details for the commands used in this article.

Up Next

Copying Files and Directories

Master cp to copy files and recursive directory structures.