back

mkdir

Ensure a directory is present

Overview

  • This module ensures a directory is present at the specified path and that it has the specified ownership and modification flags. If parent directories are not present, they are also created.

Form

(mkdir options)

Arguments

options

A hashmap of options

Options

OptionDescription
:path
type string

    The filesystem location to make the directory at.

:owner
type integerstring

    The user that should have ownership over the directory. Can be specified as the username or the user id.

:group
type integerstring

    The group that should have ownership over the directory. Can be specified as the groupname or the group id.

:mode
type integerstring

    Set the access mode of this directory.

    Can be specified as an octal value of the form 0xxx, as a decimal value, or as a change string as is accepted by the system chmod command (eg. "u+rwx").

Examples

Make a directory to store a website in on nginx

(mkdir {:path "/var/www/mysite.mydomain"
        :owner "www-data"
        :group "www-data"})