Skip to main content
drupalreleases
Release: Cms 2.2.3 — Update released for Drupal core (2.2.3)! Release: Easy Breadcrumb 2.0.11 — Minor update available for module easy_breadcrumb (2.0.11). Release: Bootstrap 8.x-3.42 — Minor update available for theme bootstrap (8.x-3.42). Release: Editoria11y Accessibility Checker 3.0.10 — Minor update available for module editoria11y (3.0.10). Release: Editoria11y Accessibility Checker 2.2.24 — Minor update available for module editoria11y (2.2.24). Release: Leaflet 10.4.13 — Minor update available for module leaflet (10.4.13). Release: Flag 5.1.1 — Minor update available for module flag (5.1.1). Release: Layout Paragraphs 3.0.0-beta5 — New beta version released for module layout_paragraphs (3.0.0-beta5). Module Revived: Bootstrap 8.x-3.41 — Theme bootstrap updated after 6 months of inactivity (8.x-3.41). Security Coverage: Component Library — Module component_library now has official Drupal security advisory coverage.

Orphaner is a command-line tool that helps you identify and remove stale files from your Drupal site. It allows you to list files within a directory and then delete individual files, but it does not automatically determine if a file is safe to remove, leaving that decision to the administrator.

Orphaner

Why Orphaner?

Drupal sites can accumulate stale files over time through development, deployments, module removal, migrations, testing, or manual changes.

Orphaner provides a lightweight command-line interface for inspecting a directory and removing individual files without requiring a full filesystem management solution.

It intentionally does **not** attempt to automatically determine whether a file is truly "orphaned." The administrator is responsible for identifying files that are safe to remove.

Installation

Install the module with Composer:

composer require drupal/orphaner

Enable the module:

drush en orphaner

Clear Drupal caches if necessary:

drush cr

Usage

Show the module location

drush orphaner

This prints the absolute filesystem path to the Orphaner module.

List files

Use `--list` to recursively list files below a directory:

drush orphaner --list /var/www/html/web/modules/contrib/orphaner

Hidden files are included in the listing.

Delete a file

Use `--delete` to remove one file:

drush orphaner --delete /var/www/html/web/modules/contrib/orphaner/test/deleteme.php

Or use the shorter command alias:

drush orph --delete /path/to/file

Orphaner only permits deletion of regular files. It will refuse to delete directories and other filesystem objects.

Before deleting a file, the command verifies that it exists. After running `rm`, it also verifies that the file has actually been removed.

Command reference

| Command | Description |
| ----------------------------------- | ---------------------------------------- |
| `drush orphaner` | Print the installed Orphaner module path |
| `drush orphaner --list ` | Recursively list files |
| `drush orphaner --delete ` | Delete one regular file |
| `drush orph ...` | Alias for `drush orphaner` |

File deletion and safety

The `--delete` operation is intentionally limited to **one regular file at a time** and only to the Drupal project in context.
You cannot delete any file outside the Drupal project.

Orphaner:

* Checks that the supplied path exists.
* Refuses to delete directories.
* Refuses to delete anything that is not a regular file.
* Passes the path to Symfony Process as a separate argument rather than constructing a shell command.
* Uses `rm --
` to prevent a filename beginning with `-` from being interpreted as an `rm` option.
* Verifies that the file no longer exists after the command completes.

However, `--delete` is a destructive operation. Always verify the supplied path before executing the command.

Security

Do not use `--delete` unless you are certain that the specified file can safely be removed!

If you believe you have found a security vulnerability, please follow the Drupal project's security reporting process rather than publicly disclosing the vulnerability in the issue queue.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Aug 2026
Latest release
1 month ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.x-dev Dev 10–11 Aug 17, 2026