[PR #10328] Add functionality to remove empty media folders on item delete #12436

Closed
opened 2026-02-07 06:55:50 +03:00 by OVERLORD · 0 comments
Owner

Original Pull Request: https://github.com/jellyfin/jellyfin/pull/10328

State: closed
Merged: No


Changes

  • Make LibraryManager.DeleteItem async
  • Remove LibraryManager.DeleteItem notifyParentItem param (unused)
  • Delete all metadata and images on media item delete (when deleting media item from filesystem)
  • Remove empty folders from filesystem on media item delete

Eempty media folders will be deleted when the last item is deleted. Eg. deleting the last episode from a season in a series would delete the season in the library and directory on disk. If that season was the last season for that series, the series would also be deleted from the library and disk.

Tested on Windows only, though I expect it should work for other operating systems.

Detection for existing files uses the same ignore list as media import to ensure standard hidden files are not mistaked for user files. If there are any remaning files that are not safe to ignore and do not belong to Jellyfin, the delete action for the folder will be skipped.

Issues
ex. Fixes #832

**Original Pull Request:** https://github.com/jellyfin/jellyfin/pull/10328 **State:** closed **Merged:** No --- **Changes** - Make LibraryManager.DeleteItem async - Remove LibraryManager.DeleteItem notifyParentItem param (unused) - Delete all metadata and images on media item delete (when deleting media item from filesystem) - Remove empty folders from filesystem on media item delete Eempty media folders will be deleted when the last item is deleted. Eg. deleting the last episode from a season in a series would delete the season in the library and directory on disk. If that season was the last season for that series, the series would also be deleted from the library and disk. Tested on Windows only, though I expect it should work for other operating systems. Detection for existing files uses the same ignore list as media import to ensure standard hidden files are not mistaked for user files. If there are any remaning files that are not safe to ignore and do not belong to Jellyfin, the delete action for the folder will be skipped. **Issues** ex. Fixes #832
OVERLORD added the pull-request label 2026-02-07 06:55:50 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#12436