Skip to content
File systemReference

listfiles

List immediate children of a workspace folder.

Details#

List immediate children of a workspace folder. A 1-based array of relative file and folder paths. No recursive traversal or ordering guarantee. Missing folders raise an error.

Signature#

Luau
listfiles(path: string?): {string}

Parameters#

ParameterTypeDescription
pathoptionalstringRelative folder; omitted, nil or empty string selects the workspace root.

Returns#

A 1-based array of relative file and folder paths. No recursive traversal or ordering guarantee. Missing folders raise an error.

Examples#

Local example

Luau
makefolder("docs-example")
for _, path in ipairs(listfiles("docs-example")) do
    print(path)
end