# mkdir/rmdir¶

mkdir creates a directory. It takes as an argument the directory to create (with an absolute or a relative path)

If the directory already exists, mkdir issues an error.

By default, the mkdir command creates only one directory at a time. Thus, to create a directory c in the directory b in a. If a and b don't exist, one must execute:

# make a/b/c if a and b don't exist
mkdir a
mkdir a/b
mkdir a/b/c


The option -p makes parents as needed:

# make a/b/c if a and b don't exist
mkdir -p a/b/c


rmdir removes a directory.

To be deleted, a directory must be empty. Otherwise, an error is issued (beware of hidden files).

In a similar manner as mkdir, to delete all directories a/b/c, one must delete c in a/b/c then b in a/b then a.

rmdir a/b/c
rmdir a/b
rmdir a


For rmdir, the option -p exists also. It removes all empty directories in the specified path.