> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# listfiles

> Returns an array table of the direct children of an existing workspace directory.

<div className="real-function-page">
  ```lua theme={null}
  listfiles(path: string): table
  ```

  ## Đối số

  <ParamField path={"path"} type={"string"} required>
    Directory path resolved inside the workspace after separator normalization and workspace-boundary checks. Empty path or / is treated as ./; invalid or outside-workspace paths error.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"paths"} type={"table"}>
    Array table of workspace-relative path strings for direct child entries. Files and folders can both be included; entries are not sorted by this function.
  </ResponseField>

  ## Ví dụ

  Liet ke direct child paths ben trong workspace directory dang ton tai.

  ```lua theme={null}
  makefolder("examples/listing")
  writefile("examples/listing/config.json", "{}")
  makefolder("examples/listing/nested")

  for _, path in ipairs(listfiles("examples/listing")) do
      print(path)
  end
  ```
</div>
