> ## Documentation Index
> Fetch the complete documentation index at: https://bazel-flags-doc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# DirectoryExpander

Expands directories created by [`ctx.actions.declare_directory`](../builtins/actions.html#declare_directory) during the execution phase. This is useful to expand directories in [`map_each`](../builtins/Args.html#add_all.map_each).

## Members

* [expand](#expand)

## expand

```
list DirectoryExpander.expand(file)
```

If the given `File` is a directory, this returns a list of `File` s recursively underneath the directory. Otherwise, this returns a list containing just the given `File` itself.

### Parameters

ParameterDescription`file`[File](../builtins/File.html);
required

The directory or file to expand.
