[Shell command] Create missing parent directories with mkdir -p

Created on November 30, 2026

Pass -p to mkdir to create any missing directories along the specified path. The example starts with no project directory.

mkdir -p project/logs/2026
find project -type d | sort
project
project/logs
project/logs/2026

-p is short for --parents. Existing directories along the path are accepted, so the same command can be repeated.

Reference

Shell command mkdir