How to Clean Up Your Plex Library -- Remove Duplicates and Fix Mismatches
Plex libraries accumulate clutter over time. Duplicate files sneak in when you acquire a better version of something you already have. Metadata mismatches cause the wrong poster or description to appear. Deleted media leaves behind orphaned metadata and thumbnails. And the database itself grows bloated with stale entries. None of this is harmful in isolation, but collectively it degrades the browsing experience and wastes disk space.
A periodic cleanup keeps your library organized, your server responsive, and your disk usage under control. This guide covers every cleanup operation available in Plex, from built-in tools to third-party automation.
Empty Trash
When you delete a media file from disk, Plex does not automatically remove the corresponding entry from its database. Instead, the entry becomes an orphan -- it still appears in your library but shows as unavailable when you try to play it. "Empty Trash" removes these orphaned entries.
To empty the trash for a specific library, open the Plex Web interface, click the three-dot menu next to the library name, and select "Empty Trash." You can also enable automatic trash emptying: go to Settings, Library, and enable "Empty trash automatically after every scan." This ensures that deleted files are cleaned up as soon as Plex notices they are gone.
When to use it: After deleting or moving media files outside of Plex. If you reorganized your folder structure or removed unwanted content, empty the trash to sync Plex's database with what is actually on disk.
Caution: If your media is on a network share that becomes temporarily unavailable, Plex may treat all files as deleted. Automatic trash emptying would then wipe your entire library metadata. If your media is on unreliable storage, consider disabling automatic trash emptying and running it manually when you know the share is mounted.
Clean Bundles
Plex stores metadata for each library item in a "bundle" -- a folder containing artwork images, XML metadata, and other cached data. When a library item is removed (via trash emptying) or re-matched to a different metadata entry, the old bundle becomes orphaned. Clean Bundles removes these orphaned folders.
Access it from the same three-dot menu next to the library name, or find it under Settings, Troubleshooting, "Clean Bundles." This operation scans the Metadata directory and cross-references each bundle against the database. Any bundle without a matching database entry is deleted.
Space savings: Orphaned bundles can accumulate to several gigabytes on large libraries, especially if you frequently re-match content or rebuild libraries. Cleaning bundles reclaims that space.
Optimize Database
The Plex database is a SQLite file that grows and fragments over time as entries are added, modified, and deleted. The "Optimize Database" operation runs SQLite maintenance commands (VACUUM, REINDEX, ANALYZE) that compact the file, rebuild indexes, and update query statistics.
You can run it manually from Settings, Troubleshooting, "Optimize Database," or let it run as part of the scheduled tasks. After a major cleanup (deleting hundreds of items, emptying trash, cleaning bundles), run an optimization to consolidate the freed space.
Performance impact: An optimized database responds faster to queries, which means snappier library browsing and search results. The improvement is most noticeable on large libraries (over 5,000 items) and when the database is on a spinning hard drive.
Finding and Handling Duplicates
Duplicates in Plex come in two forms: true duplicate files (two copies of the same content on disk) and duplicate database entries (one file matched to multiple items or appearing in multiple libraries).
Using Plex's Built-in Duplicate View
Plex has a built-in way to find duplicate files within a movie library. In the Plex Web interface, navigate to your movie library and use the filter options. Select "Duplicates" from the filter dropdown. This shows all movies that have more than one file associated with them.
For each duplicate, click into the movie and look at the "Play Version" option to see all associated files with their quality details (resolution, bitrate, codec, file size). You can then delete the inferior version while keeping the better one.
Identifying True Duplicates on Disk
The Plex duplicate filter only catches files that matched to the same metadata entry. If two copies of the same movie matched under slightly different names (one as the original title, one as a localized title), they will not appear as duplicates. For a more thorough duplicate check, use a filesystem-level tool:
- fdupes (Linux): Scans directories for files with identical content based on checksums.
- jdupes: A faster, more feature-rich fork of fdupes.
- DupeGuru (cross-platform): A GUI tool that finds duplicates by name, content, or fuzzy matching.
After removing filesystem-level duplicates, rescan the library and empty the trash to update Plex.
Merging Split Entries
Sometimes Plex splits a single movie into multiple entries -- for example, if you have the theatrical cut and director's cut as separate files with slightly different names. If you want them grouped under one entry, select both items in the library view, right-click, and choose "Merge." This combines them into a single entry with multiple playback versions.
Conversely, if Plex incorrectly merged two different movies into one entry, select the item, click the three-dot menu, and choose "Split Apart."
Fixing Metadata Mismatches
A metadata mismatch occurs when Plex identifies a file as the wrong title. This is common with short or generic filenames, foreign films, or when files lack a release year. Signs of a mismatch include wrong poster art, incorrect descriptions, mismatched episode numbers, or completely wrong titles.
Manual Fix Match
Click the three-dot menu on the mismatched item and select "Fix Match." Search for the correct title, optionally including the year to narrow results. Select the correct match and Plex will re-download the appropriate metadata and artwork. For TV shows, you may need to fix the match at the show level, then verify that individual episodes are correctly matched.
Preventing Future Mismatches
The most effective prevention is correct file naming. Follow Plex's naming conventions:
- Movies:
Movie Title (Year).extin its own folder - TV Shows:
Show Name/Season 01/Show Name - S01E01 - Episode Title.ext - Music:
Artist/Album/01 - Track Title.ext
Including the year in movie filenames dramatically reduces mismatches, especially for remakes and common titles.
Bulk Cleanup with Plex Meta Manager
For large libraries, manual cleanup is tedious. Plex Meta Manager (PMM) is a community tool that automates metadata management, collection creation, and library cleanup tasks. It can:
- Automatically create and maintain collections based on genres, decades, studios, or custom criteria
- Standardize metadata across your library (consistent genres, content ratings, sort titles)
- Remove orphaned collections that no longer contain any items
- Sync ratings from external sources like IMDb or Trakt
- Mass-update labels and tags
PMM runs as a scheduled script and can be configured to perform specific cleanup operations on a regular basis. It connects to your Plex server via the API and makes changes programmatically.
Establishing a Maintenance Schedule
Regular maintenance prevents clutter from accumulating in the first place. Here is a practical schedule:
- Weekly: Let Plex's built-in scheduled tasks handle database backup, optimization, and cache cleanup.
- Monthly: Manually check for duplicates in movie libraries. Clean bundles. Review recently added items for mismatches.
- Quarterly: Run a full library scan with "Refresh All Metadata" to catch any stale entries. Check disk usage in the Plex data directory and clean up if the Metadata or Cache folders have grown excessively.
- After major changes: Any time you reorganize your folder structure, add a large batch of content, or move media between drives, follow up with a library scan, trash emptying, bundle cleaning, and database optimization -- in that order.
This schedule takes minimal effort but keeps your library in excellent shape. The key is consistency: small regular cleanups are far easier than a massive cleanup after months of neglect.
Phlix -- The Photo Browser for Plex
A clean Plex library means a better photo browsing experience. Phlix gives your Plex photos a dedicated chronological timeline, offline downloads, and 4K AirPlay slideshows. Free to browse, Pro from $6.99/yr.
Download Phlix FreeiOS 17+ · Works with any Plex Media Server