[mythtv-users] Script to remove all old recordings prior a given date

Jean-Yves Avenard jyavenard at gmail.com
Thu Nov 24 04:23:03 UTC 2016


On 24 November 2016 at 15:15, Peter Bennett <cats22 at comcast.net> wrote:
> On 11/23/2016 10:49 PM, Jean-Yves Avenard wrote:
>> Hi
>>
>> Having a 32TB backend, the amount of recordings kept has become insane.
>>
>> How could I remove in one go all the recording that are older than two
>> years old?
>>
>> I guess after that, I can use the find_orphans script to clean up the
>> storage space.
>> _______________________________________________
> There have been people in the list who have reported using find_orphans
> to clean up thousands of deleted files and they have had some serious
> problem - I am not sure of the details or if it has been fixed.
>
> For your case I think what I would do is write a sql script, something
> like this
>
> Find the recgroupid:
> select recgroupid from recgroups where recgroup = 'Deleted';
>
> Then:
> update recorded set recgroup = 'Deleted',
> recgroupid = xxxxx , autoexpire = 9999
> where starttime < '2014-11-23' ;
>
> After the appropriate delete waiting time they will be deleted. I have
> used this a lot and not had problems with doing it. (But not with
> thousands of files at one time).
>
> It also gives you time to change your mind (I have my delete delay set
> at 7 days).

Thanks for that.

Sound like a reasonable approach.

I don't mind deleting it all, if things go pear shape, the file system
is ZFS with 6-hourly snapshots rotating every 2 months... so can
always easily retrieve those I didn't want to delete.


More information about the mythtv-users mailing list