# `Dagger.Directory`
[🔗](https://github.com/dagger/dagger/blob/v0.20.5/sdk/elixir/lib/dagger/gen/directory.ex#L2)

A directory.

# `t`

```elixir
@type t() :: %Dagger.Directory{client: term(), query_builder: term()}
```

# `as_git`

```elixir
@spec as_git(t()) :: Dagger.GitRepository.t()
```

Converts this directory to a local git repository

# `as_module`

```elixir
@spec as_module(t(), [{:source_root_path, String.t() | nil}]) :: Dagger.Module.t()
```

Load the directory as a Dagger module source

# `as_module_source`

```elixir
@spec as_module_source(t(), [{:source_root_path, String.t() | nil}]) ::
  Dagger.ModuleSource.t()
```

Load the directory as a Dagger module source

# `changes`

```elixir
@spec changes(t(), t()) :: Dagger.Changeset.t()
```

Return the difference between this directory and another directory, typically an older snapshot.

The difference is encoded as a changeset, which also tracks removed files, and can be applied to other directories.

# `chown`

```elixir
@spec chown(t(), String.t(), String.t()) :: t()
```

Change the owner of the directory contents recursively.

# `diff`

```elixir
@spec diff(t(), t()) :: t()
```

Return the difference between this directory and an another directory. The difference is encoded as a directory.

# `digest`

```elixir
@spec digest(t()) :: {:ok, String.t()} | {:error, term()}
```

Return the directory's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.

# `directory`

```elixir
@spec directory(t(), String.t()) :: t()
```

Retrieves a directory at the given path.

# `docker_build`

```elixir
@spec docker_build(t(),
  dockerfile: String.t() | nil,
  platform: Dagger.Platform.t() | nil,
  build_args: [Dagger.BuildArg.t()],
  target: String.t() | nil,
  secrets: [Dagger.SecretID.t()],
  no_init: boolean() | nil
) :: Dagger.Container.t()
```

Use Dockerfile compatibility to build a container from this directory. Only use this function for Dockerfile compatibility. Otherwise use the native Container type directly, it is feature-complete and supports all Dockerfile features.

# `entries`

```elixir
@spec entries(t(), [{:path, String.t() | nil}]) ::
  {:ok, [String.t()]} | {:error, term()}
```

Returns a list of files and directories at the given path.

# `exists`

```elixir
@spec exists(t(), String.t(),
  expected_type: Dagger.ExistsType.t() | nil,
  do_not_follow_symlinks: boolean() | nil
) :: {:ok, boolean()} | {:error, term()}
```

check if a file or directory exists

# `export`

```elixir
@spec export(t(), String.t(), [{:wipe, boolean() | nil}]) ::
  {:ok, String.t()} | {:error, term()}
```

Writes the contents of the directory to a path on the host.

# `file`

```elixir
@spec file(t(), String.t()) :: Dagger.File.t()
```

Retrieve a file at the given path.

# `filter`

```elixir
@spec filter(t(),
  exclude: [String.t()],
  include: [String.t()],
  gitignore: boolean() | nil
) :: t()
```

Return a snapshot with some paths included or excluded

# `find_up`

```elixir
@spec find_up(t(), String.t(), String.t()) ::
  {:ok, String.t() | nil} | {:error, term()}
```

Search up the directory tree for a file or directory, and return its path. If no match, return null

# `glob`

```elixir
@spec glob(t(), String.t()) :: {:ok, [String.t()]} | {:error, term()}
```

Returns a list of files and directories that matche the given pattern.

# `id`

```elixir
@spec id(t()) :: {:ok, Dagger.DirectoryID.t()} | {:error, term()}
```

A unique identifier for this Directory.

# `name`

```elixir
@spec name(t()) :: {:ok, String.t()} | {:error, term()}
```

Returns the name of the directory.

# `search`

```elixir
@spec search(t(), String.t(),
  paths: [String.t()],
  globs: [String.t()],
  literal: boolean() | nil,
  multiline: boolean() | nil,
  dotall: boolean() | nil,
  insensitive: boolean() | nil,
  skip_ignored: boolean() | nil,
  skip_hidden: boolean() | nil,
  files_only: boolean() | nil,
  limit: integer() | nil
) :: {:ok, [Dagger.SearchResult.t()]} | {:error, term()}
```

Searches for content matching the given regular expression or literal string.

Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes.

# `sync`

```elixir
@spec sync(t()) :: {:ok, t()} | {:error, term()}
```

Force evaluation in the engine.

# `terminal`

```elixir
@spec terminal(t(),
  container: Dagger.ContainerID.t() | nil,
  cmd: [String.t()],
  experimental_privileged_nesting: boolean() | nil,
  insecure_root_capabilities: boolean() | nil
) :: t()
```

Opens an interactive terminal in new container with this directory mounted inside.

# `with_changes`

```elixir
@spec with_changes(t(), Dagger.Changeset.t()) :: t()
```

Return a directory with changes from another directory applied to it.

# `with_directory`

```elixir
@spec with_directory(t(), String.t(), t(),
  exclude: [String.t()],
  include: [String.t()],
  gitignore: boolean() | nil,
  owner: String.t() | nil
) :: t()
```

Return a snapshot with a directory added

# `with_error`

```elixir
@spec with_error(t(), String.t()) :: t()
```

Raise an error.

# `with_file`

```elixir
@spec with_file(t(), String.t(), Dagger.File.t(),
  permissions: integer() | nil,
  owner: String.t() | nil
) ::
  t()
```

Retrieves this directory plus the contents of the given file copied to the given path.

# `with_files`

```elixir
@spec with_files(t(), String.t(), [Dagger.FileID.t()], [
  {:permissions, integer() | nil}
]) :: t()
```

Retrieves this directory plus the contents of the given files copied to the given path.

# `with_new_directory`

```elixir
@spec with_new_directory(t(), String.t(), [{:permissions, integer() | nil}]) :: t()
```

Retrieves this directory plus a new directory created at the given path.

# `with_new_file`

```elixir
@spec with_new_file(t(), String.t(), String.t(), [{:permissions, integer() | nil}]) ::
  t()
```

Return a snapshot with a new file added

# `with_patch`

```elixir
@spec with_patch(t(), String.t()) :: t()
```

Retrieves this directory with the given Git-compatible patch applied.

> #### Experimental {: .warning}
>
> "This API is highly experimental and may be removed or replaced entirely."

# `with_patch_file`

```elixir
@spec with_patch_file(t(), Dagger.File.t()) :: t()
```

Retrieves this directory with the given Git-compatible patch file applied.

> #### Experimental {: .warning}
>
> "This API is highly experimental and may be removed or replaced entirely."

# `with_symlink`

```elixir
@spec with_symlink(t(), String.t(), String.t()) :: t()
```

Return a snapshot with a symlink

# `with_timestamps`

```elixir
@spec with_timestamps(t(), integer()) :: t()
```

Retrieves this directory with all file/dir timestamps set to the given time.

# `without_directory`

```elixir
@spec without_directory(t(), String.t()) :: t()
```

Return a snapshot with a subdirectory removed

# `without_file`

```elixir
@spec without_file(t(), String.t()) :: t()
```

Return a snapshot with a file removed

# `without_files`

```elixir
@spec without_files(t(), [String.t()]) :: t()
```

Return a snapshot with files removed

---

*Consult [api-reference.md](api-reference.md) for complete listing*
