What causes orphan recording files?

"Orphan" meaning existing recording files on disk that do not appear in Channels app 'Recordings' listing.

I have found numerous such files - some created well over a year ago. (!)

Also, can anything be done by either a user or developers to prevent this from happening? And, no, I haven't migrated to a new disk or performed any other "maintenance" action on the disk since the original install of Channels.

It's a very tedious and time-consuming process to identify such files and delete them manually via file system (NTFS) to free-up space.

When you delete recordings in Channels DVR, this is what happens:

  1. Recordings become unlisted from the library and end up in the Trash. The files themselves are still present on the disk.

  2. After either 1, 3, or 10 days (as defined in the settings) the Trash is cleared. At that moment, the files get deleted from the disk.

So you seem to be in situation #1 but you said some files are from one year ago. So it's as if the files couldn't be deleted from the disk when the trash got cleared.

Could it be that those files were being used by another program and Windows was unable to delete them?

Were the files moved or renamed?

There is a feature in Channels DVR to get a list of recordings still present in the DVR database but not physically present on the disk. Your situation is reversed.

It should be possible to write a script to generate a list of recordings present on the disk but not in the DVR database.

Thanks much for the reply.

I suppose it's possible files were being used by another program and Windows was unable to delete them - but I'd guess highly unlikely. To my knowledge, those files are never moved or renamed and no reason to do so. (?) That disk drive is dedicated solely to Channels - no other program creates or manipulates files on that drive.

Re writing a script to identify "orphaned" recordings files, I have no idea how to do that. But yes, that would be very useful.

I will see if I have enough spare time during the week to write a script that gives a list of extra recordings that are left on the disk and unknown to the DVR.

I might be surprised to see that I also have some.

My server also runs on Windows so that will be interesting if that reveals a possible bug.

This is definitely an issue on Windows, I've seen it too.

1 Like

Excellent! Looking forward to using it. Thanks much.

Well, to my surprise, I have orphaned recordings too and way more than I imagined!

I'm working on a script now and it surprised me with this output:

Found 103 orphaned recordings:
 → I:\DVR\Movies\Ace Ventura When Nature Calls (1995) 2021-06-26-1457.mpg
 → I:\DVR\Movies\Alien (1979) 2021-07-02-1927.mpg
 → I:\DVR\Movies\Along Came Polly (2004) 2021-07-10-1627.mpg
 → I:\DVR\Movies\American Made (2017) 2021-06-08-1720.mpg
 → I:\DVR\Movies\American Pie Presents The Book of Love (2009) 2021-06-27-0257.mpg
 → I:\DVR\Movies\Born on the Fourth of July (1989) 2021-07-03-0800.mpg

and more.

I will clean up the code and publish the script shortly.

Thanks! When you publish script, please provide instructions for running on Windows. PowerShell script would be perfect!

Sorry, this is a Python script. :frowning:

I'm not familiar with PowerShell but I can see if with help from AI I can convert it.

Do you have any that are recent? If you search your logs do you see anything about them?

In my case, they are old files. The most recent ones are from November 2023 (2 of them) and all others are from 2021 (101 of them).

You may now download a PowerShell script:
mjitkop/cdvr-find-orphaned-recordings: Get a list of recordings present on disk(s) but unknown to a Channels DVR server.

You will want to download the file cdvr_find_orphaned_recordings.ps1.
The instructions to run it are explained there.

For other people who would prefer a Python script, there is one available there too.

Excellent! Much appreciate.

However, there may be a bug in the PowerShell script.

See below the last 5 lines of output. The numbers don't add up.

Checking storage paths for files...
-> Found 3 files in U:\Channels DVR\Movies
-> Found 27 files in U:\Channels DVR\TV
-> Found a total of 3 files on disks.
No orphaned recordings found.

Thank you for the feedback! I will take a look at this bug.

1 Like