fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Idiom # 180: List files in directory

See programming-idioms.org:

Code

io.dir.traverse collects the entries of directory d into a list. It starts with an empty Sequence [] and appends each entry p. Setting the argument to false disables descending into subdirectories. The result x is an outcome (Sequence io.path), returning an error if the directory fails to open.

The order of the entries is not defined, it depends on the file system.

Runnable Examples

Using io.dir.traverse:

io.dir.use opens the directory and exposes its entries via io.dir.Read.env.next. The loop then reads entries until next returns nothing:

last changed: 2026-10-14