Mkdir combined with "-p" flag Mkdir combined with "-p" flag shell shell

Mkdir combined with "-p" flag


It looks like you're following a Unix-ish tutorial but running the commands on Windows in cmd.exe.

As the usage instructions say:

C:\>mkdir /?Creates a directory.MKDIR [drive:]pathMD [drive:]pathIf Command Extensions are enabled MKDIR changes as follows:MKDIR creates any intermediate directories in the path, if needed.For example, assume \a does not exist then:    mkdir \a\b\c\dis the same as:    mkdir \a    chdir \a    mkdir b    chdir b    mkdir c    chdir c    mkdir dwhich is what you would have to type if extensions were disabled.

Windows commands don't use - for options (and in particular, the mkdir command built into cmd doesn't understand -p).


The part about "privileged" is for the shell option -p, as in bash -p. It has nothing to do with mkdir -p, which is explained in man mkdir:

-p, --parents

         no error if existing, make parent directories as needed

But again, that only applies to the Unix mkdir, not Windows / cmd.


"-p" creates parent directories if they don't exist.

For example:

With "-p" if "first" directory doesn't exist.

mkdir -p first/second  # "first" parent directory is created

Without "-p" if "first" directory doesn't exist.

mkdir first/second  # "first" parent directory is not created mkdir: cannot create directory ‘first/second’: No such file or directory