Create Directories Recursively in Linux

When working with filesystem in Linux, may need to create a new directory in another directory which does not already exist. A process that creates a specified directory and parent directories can be called recursive directories creation. This tutorial explains how to create directories recursively in Linux.

To create a new directory and all missing parent directories recursively, use mkdir command with -p option:

mkdir -p web/assets/images

When the -p option is used, the command creates only directories which does not already exist.

Leave a Comment

Your email address will not be published.