docs/versions/8.4.0/rules/lib/builtins/DirectoryExpander.mdx
{% dynamic setvar source_file "src/main/java/com/google/devtools/build/lib/starlarkbuildapi/DirectoryExpander.java" %} {% dynamic setvar version "8.4.0" %} {% dynamic setvar original_path "/rules/lib/builtins/DirectoryExpander" %} {% include "_buttons.html" %}
<!-- {% raw %} -->Expands directories created by <a href='../builtins/actions.html#declare_directory'><code>ctx.actions.declare_directory</code></a> during the execution phase. This is useful to expand directories in <a href='../builtins/Args.html#add_all.map_each'><code>map_each</code></a>.
<h2>Members</h2> <ul> <li> <a href="#expand">expand</a> </li> </ul> <h2 id="expand">expand</h2>
<p><pre class="rule-signature"><a class="anchor" href="../core/list.html">list</a> DirectoryExpander.expand(file)</pre></p>
If the given <code>File</code> is a directory, this returns a list of <code>File</code>s recursively underneath the directory. Otherwise, this returns a list containing just the given <code>File</code> itself.
<!-- hide-from-toc is a class used by DevSite for the public Bazel site
(https://developers.google.com/devsite/reference/styles/headings#hide_headings_from_the_toc) -->
<h3 class="hide-from-toc">Parameters</h3>
<table class="table table-bordered table-condensed table-params">
<colgroup>
<col class="col-param">
<col class="param-description">
</colgroup>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td id="expand.file">
<code>file</code>
</td>
<td>
<a class="anchor" href="../builtins/File.html">File</a>;
required
The directory or file to expand.
</td>
</tr>
</tbody>
</table>