Learn R Programming

fs (version 2.0.0)

is_dir_empty: Check if a directory is empty

Description

This function checks whether a given directory is empty or not.

Usage

is_dir_empty(path)

Value

A logical value. Returns TRUE if the directory is empty, FALSE otherwise.

Arguments

path

A character string specifying the path to the directory to check.

Examples

Run this code
if (FALSE) {
is_dir_empty("path/to/empty/directory")  # Returns TRUE
is_dir_empty("path/to/non-empty/directory")  # Returns FALSE
}

Run the code above in your browser using DataLab