Filesystem

delfile

Deletes an existing regular file inside the workspace.

Syntax

delfile(path: string)

Arguments

NameTypeDescription
pathstringPath resolved inside the workspace after separator normalization and workspace-boundary checks. The target must exist and be a regular file; folders are not accepted.

Description

Deletes an existing regular file inside the workspace.

Call it with 1 parameter(s): path. The argument table explains which values are required and which ones only refine the behavior.

It does not return data. Treat the call as an action and handle errors around the call site when needed.

Example

Delete an existing workspace file.

local path = "examples/temporary.txt"
writefile(path, "temporary")

delfile(path)
print(isfile(path))