# FolderEnum

The **FolderEnum** object is returned from the [**FSUtil**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/fsutil)**.ReadDir** method. It lets you enumerate (optionally, recursively) the contents of a folder.

| Property Name | Return Type | Description                                                                      |
| ------------- | ----------- | -------------------------------------------------------------------------------- |
| complete      | *bool*      | **True** if the enumeration is complete, otherwise **False**.                    |
| error         | *int*       | If an error occurs this will return the error code. It will return 0 on success. |

| Method Name | **Arguments**                                                                | Return Type                                                                                                                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ----------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Close       | *none*                                                                       | *none*                                                                                                                                       | Closes the underlying file system handle used to perform the enumeration. You might call this method if you want to delete the folder you just enumerated. After this method is called the **complete** property will return **True**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Next        | <p>\<int:count><br><<a href="vector"><strong>Vector</strong></a>:vector></p> | <p><em>object:</em><a href="item"><strong>Item</strong></a> </p><p>or</p><p><em>object:</em><a href="vector"><strong>Vector</strong></a></p> | <p>Returns the next item in the enumeration.</p><p>By default (with no arguments provided) a single <a href="item"><strong>Item</strong></a> object is returned. For higher performance, you can specify a number as the first argument to return more than one item at once - in this case, a <a href="vector"><strong>Vector</strong></a> of <a href="item"><strong>Item</strong></a> objects is returned instead. Specify <strong>-1</strong> to return all items in the folder in one call.</p><p>You can also create your own <a href="vector"><strong>Vector</strong></a> and pass it as the second argument to stop Opus creating a new <a href="vector"><strong>Vector</strong></a> each time.</p> |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/folderenum.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
