---
title: "file:listdir — List directory"
description: "iXML command file:listdir: List directory."
canonical_url: "https://www.zeyos.com/ixml/ref/file-listdir"
markdown_url: "https://www.zeyos.com/ai/guide/ixml/ref/file-listdir.md"
section: "ixml-reference"
authority: "reference"
language: "en"
source_repository: "https://cloud.zeyos.com/__doc/ixmldoc.xml"
source_sha256: "a23f04e6a98628ca3c273c3b8dd2c33c034cfda3e0f00478d8793074fd2f70dd"
---

# file:listdir — List directory

FILE:LISTDIR lists the filenames of all files within a directory.

### Attributes
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| var | var |  | Result variable name |
| dirname | string |  | Directory name/URL |

### Children
- (none)

### Parents
- (not restricted in the reference)

### Result
- binding: var; type: array; predicate: no-result-propagation

### Examples

```xml
<file:listdir var="files" dirname="./test"/>

<foreach var="files" var_value="filename">
	<if value1="$filename" func="$" value2=".inc">
		<output>$filename&n;</output>
	</if>
</foreach>

<!--
ixml.inc
ixml_link.inc
-->
```
