Jellyfin Forum
Cleaning of orphaned nfo files - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Development (https://forum.jellyfin.org/f-development)
+--- Forum: Feature Requests (https://forum.jellyfin.org/f-feature-requests)
+--- Thread: Cleaning of orphaned nfo files (/t-cleaning-of-orphaned-nfo-files)



Cleaning of orphaned nfo files - Geekphreek - 2024-11-03

https://features.jellyfin.org/posts/2939/clean-orphaned-nfo-files

Does anyone else have this issue? You rename a video or three hundred and then a whole bunch of new NFO files show up, making the older ones redundant. I'm surprised NFO detoxing isn't part of the library scan. Is there a reason behind it not being?


RE: Cleaning of orphaned nfo files - Efficient_Good_5784 - 2024-11-03

I did. Though in my case, it's just in case I forget to delete the leftover NFO/image thumbnails when I delete/rename a video file.

What I did to solve this issue is to create a script that compares all NFO and image files to the existing video files.
If the filenames don't match up, they get deleted by my script.

If I am to guess why this isn't built into Jellyfin, it's probably because users wouldn't want Jellyfin deleting all files except for those scanned into Jellyfin's database. Some people link their Jellyfin servers to libraries that are in use by some other apps/media servers.


RE: Cleaning of orphaned nfo files - hr33 - 2025-02-22

(2024-11-03, 06:35 PM)Efficient_Good_5784 Wrote: What I did to solve this issue is to create a script that compares all NFO and image files to the existing video files.
If the filenames don't match up, they get deleted by my script.

Can you please share the script code? Thanks!


RE: Cleaning of orphaned nfo files - Efficient_Good_5784 - 2025-02-22

(2025-02-22, 11:10 AM)hr33 Wrote: Can you please share the script code? Thanks!
I recommend you test run this script on data you don't care about first.
Or if your server supports snapshots, take one of your data just in case it doesn't work for you and you want to revert any changes.
I specifically made my script for my TrueNAS library, so I set the script to ignore any directories with ".zfs" to avoid looking in snapshot folders.

https://github.com/maru801/jellyfin-scripts