Capy-Bearer Documentation

dir_remove

host call

Capy

function dir_remove(path : string, recursive : bool = false) bool

Description

dir_remove() removes a directory.

Without recursive, the directory must be empty. With recursive = true, it removes every contained file and directory.

Parameters

path : the directory path to remove

recursive : true removes the directory and its contents

Return Values

true on success.

Example

Capy

var root := file_temp("/tmp/capy-doc-dir-remove-")
file_unlink(root)
mkdir(root)
file_put_contents(path_join(root, "child.txt"), "x")
print(dir_remove(root, true), "\n")