File Inspector
This module helps clean up your Drupal site by finding files on your server that are no longer connected to any content. It provides a report where you can review, safely delete these orphaned files, or import them into the Media library.
File Inspector finds the files your site forgot about. It scans your file system and identifies unmanaged files, files that exist on disk but are not referenced by any Drupal entity (no record in file_managed), then lets administrators review, delete, or import them into the Media library from a single report screen.
Over time, a Drupal site accumulates orphaned files: leftovers from deleted content, manual uploads, migrations, and third-party tooling. File Inspector gives you a clear, actionable inventory of what is actually on disk versus what Drupal knows about, and the tools to clean it up safely.
Key features
- Orphaned file detection: classifies every discovered file as managed or unmanaged by checking it against Drupal's managed-file table.
- Built for scale: uses generator-based iteration and the Batch API to handle large file systems (100k+ files) without exhausting memory.
- Actionable report: a Views-based report with status, MIME-type, and date filters, per-row actions, and bulk operations.
- Import into Media: turn an unmanaged file into a managed File + Media entity in one click (requires the core Media module).
- Safe deletion: permanently remove orphaned files through confirmation forms, with path validation and permission gating.
- Imported-media tracking: the report links each imported row directly to the Media item it produced, so every import is traceable.
- Embedded web folder support: declare folders that hold embedded web apps (flipbooks, microsites). File Inspector records only their entry file and ignores the supporting assets, keeping them out of your deletion candidates.
How it works
Inspection runs in two phases. First, File Inspector walks the configured stream wrapper(s) and records every file it finds. Then it classifies each record as managed or unmanaged by checking it against file_managed. Results are stored in a dedicated table (not entities) for fast, scalable querying and full Views integration.
Requirements
- Drupal core 11
- Views (core)
- Media (core) — optional