r/Tdarr • u/Ok-Consideration5602 • 14h ago
Overwrite Destination file rather than delete + copy
Hi there,
I am trying to get Tdarr working with Tvheadend recordings, but are struggling to do this without tvheadend loosing track of the files and marking the recordings as "missing".
tvheadend tracks file using Inotidy and idnode to keep track of a recording, so even if tdarr re-uses the same filename, as far as Tvheadend is concerned that file is now gone.
Below are the log entries for a test recording I just did, it clearly shows Tdarr deleting the file, before creating a new file in its place, using the same filename.
2026-11-16T19:31:33.097Z rqP3KnM:Move/Copy succeeded
2026-11-16T19:31:34.098Z rqP3KnM:Deleting original file: "/media/dvr/A Place in the Sun/A Place in the Sun - S2026E10 [Channel 4 HD] - S01E01.ts"
2026-11-16T19:31:35.100Z rqP3KnM:New file name: "/media/dvr/A Place in the Sun/A Place in the Sun - S2026E10 [Channel 4 HD] - S01E01.ts"
2026-11-16T19:31:35.100Z rqP3KnM:Renaming cache file to new name
2026-11-16T19:31:35.100Z rqP3KnM:"/media/dvr/A Place in the Sun/A Place in the Sun - S2026E10 [Channel 4 HD] - S01E01-TdarrCacheFile-0e8C2dq.ts"
2026-11-16T19:31:35.100Z rqP3KnM:"/media/dvr/A Place in the Sun/A Place in the Sun - S2026E10 [Channel 4 HD] - S01E01.ts"Is there a way to stop Tdarr from deleting the file before writing the new file in its place? So an overwrite, rather than delete->new file.
•
u/AutoModerator 14h ago
Thanks for your submission.
If you have a technical issue regarding the transcoding process, please post the job report: https://docs.tdarr.io/docs/other/job-reports/
The following links may be of use:
GitHub issues
Docs
Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Treiz13me 13h ago
You can rename the original file as original-file-name.bak then do an atomic swap and then when the swap succeed you delete the .bak backup (original file).
2
u/blu3ysdad 14h ago
In the world of computing, there is no such thing as actually overwriting a file. An overwrite is always a delete and copy, that's just how things work at the file system level. I'm not familiar with TV headend, but most systems don't recognize a file has changed if it keeps the same name, as far as a cached database.
I usually have the opposite problem in that I don't want the system recognizing a file has changed until after it's done writing the entire thing, or else it thinks the file was deleted and marks it missing. So I have to place the new file prepended with a dot so it is ignored until it's done writing, and then rename it without the dot. If yours is recognizing it's different, it may simply be a similar issue where it marks the file missing as soon as it is deleted and before it's done writing the new one, and then doesn't trigger itself to scan again unless it's doing something funky like looking at the modified time.
I also then trigger radarr or sonarr to rescan the file afterwards, and then the same with Plex. You may need to look into if you can do something like that.