folder-is-empty

Example:

# Create a folder if it doesn't exist yet.
- folder-is-empty:
    path: /tmp/freckles

Description

Ensure a folder exists on the filesystem and is empty.

If a file or folder already exists for that path, it will be deleted before the new folder will be created.

If the owner and/or group variables is/are specified, create those in case they don't exist yet.

If the owner variable is specified, this frecklet will use elevated permissions.

Variables

Name Type Default Description

path

string --

The path to the folder. Required

group

string --

The group of the folder, will be created if necessary.

mode

string --

The permissions of the folder.

owner

string --

The owner of the folder, will be created if necessary.

system_user

boolean False

Whether the user (and group) should be of system user/group type.

Examples

Example 1

Create a folder if it doesn't exist yet.

Code
- folder-is-empty:
    path: /tmp/freckles

Example 2

Create a folder incl. parent folders if necessary.

Code
- folder-is-empty:
    path: /tmp/parent_1/parent_2/freckles

Command-line

frecklecute folder-is-empty --help

Usage: frecklecute folder-is-empty [OPTIONS] PATH

  Ensure a folder exists on the filesystem and is empty.

  If a file or folder already exists for that path, it will be deleted
  before the new folder will be created.

  If the ``owner`` and/or ``group`` variables is/are specified, create those
  in case they don't exist yet.

  If the ``owner`` variable is specified, this frecklet will use elevated
  permissions.

Options:
  --group GROUP_NAME              The group of the folder, will be created if
                                  necessary.
  --mode MODE                     The permissions of the folder.
  --owner USER_NAME               The owner of the folder, will be created if
                                  necessary.
  --system-user / --no-system-user
                                  Whether the user (and group) should be of
                                  system user/group type.
  --help                          Show this message and exit.