---
title: "listfiles"
description: "Lists immediate children of a workspace folder."
---

```lua
listfiles(path: string? = ""): {string}
```

---

## Aliases

None.

---

## Arguments

<ParamField body="path" type="string" default={"\"\""}>
  A UTF-8 path relative to the Byte workspace.
</ParamField>

---

## Returns

<ResponseField name="paths" type="{string}">
  Workspace-relative immediate child paths of the selected directory.
</ResponseField>

Empty/nil path means the workspace root. Returns workspace-relative entries, not a recursive tree.

**Related types:** [Filesystem types & behavior](/reference/filesystem/types).

---

## Example

```lua
for _, path in ipairs(listfiles()) do print(path) end
```
