> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prophecy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Directory gem for Data Engineering

> Return a listing of all the files in a specified directory

<Panel>
  <Info>
    Dependencies:

    * ProphecySparkBasicsPython 0.2.27+
    * ProphecyLibsPython 1.9.42+
    * ProphecyLibsScala 8.2.1+
  </Info>

  <Info>
    Cluster requirements:

    * UC dedicated clusters 14.3+ supported
    * UC standard clusters 14.3+ supported
    * Livy clusters not supported
  </Info>
</Panel>

The Directory gem returns a listing of all the files in a specified directory including file metadata such as file creation time, type, size, path, and more.

## Parameters

| Parameters             | Description                                                                           |
| ---------------------- | ------------------------------------------------------------------------------------- |
| Location               | The location of the directory that you want to return                                 |
| Include Subdirectories | A checkbox you can enable to return all of the subdirectories in the defined location |
| File Specification     | A regex filter to help you find your files in the file browser                        |

## Sample output

Below is an example output of a Directory gem. It includes seven columns:

* name
* path
* size
* creation\_time
* modification\_time
* parent\_directory
* file\_type

<img src="https://mintcdn.com/prophecy-62973bd0/J5UDJ9ATlxoXhTI3/data-engineering/gems/custom/img/directory-output.png?fit=max&auto=format&n=J5UDJ9ATlxoXhTI3&q=85&s=d4e2bcd02dc21353e06da9c2b840c83c" alt="Directory output" width="2620" height="1508" data-path="data-engineering/gems/custom/img/directory-output.png" />

## Example code

<Tip>
  To see the compiled code of your project, [switch to the Code view](/data-engineering/development/pipelines/pipelines#project-editor) in the project header.
</Tip>

<CodeGroup>
  ```python example.py theme={null}
  def directory_listing(spark: SparkSession) -> DataFrame:
   from prophecy.libs.utils import directory_listing

   return directory_listing(spark, "dbfs:/source_file.txt", False, "*.*")
  ```
</CodeGroup>

<Panel>
  <Info>
    Dependencies:

    * ProphecySparkBasicsPython 0.2.27+
    * ProphecyLibsPython 1.9.42+
    * ProphecyLibsScala 8.2.1+
  </Info>

  <Info>
    Cluster requirements:

    * UC dedicated clusters 14.3+ supported
    * UC standard clusters 14.3+ supported
    * Livy clusters not supported
  </Info>
</Panel>
