# `mix phoenix_kit.cleanup_orphaned_files`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.87/lib/mix/tasks/phoenix_kit.cleanup_orphaned_files.ex#L1)

Finds and optionally deletes orphaned media files in PhoenixKit Storage.

An orphaned file is one not referenced by any known entity (products, posts,
categories, users, publishing content, etc.).

By default this task runs in dry-run mode and only reports what would be deleted.
Use `--delete` to queue the actual deletion via Oban.

## Usage

    $ mix phoenix_kit.cleanup_orphaned_files
    $ mix phoenix_kit.cleanup_orphaned_files --delete

## Options

  * `--delete` - Queue orphaned files for deletion (default: dry-run)

## Examples

    # Dry-run: show orphaned files without deleting
    mix phoenix_kit.cleanup_orphaned_files

    # Queue all orphaned files for deletion
    mix phoenix_kit.cleanup_orphaned_files --delete

---

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