[mythtv-users] Verify files in recordings? Old data

George Nassas gnassas at mac.com
Thu Dec 14 16:49:32 UTC 2006

On 14-Dec-06, at 11:14 AM, Mark Hutchinson wrote:

> I think I may have some files in my recordings directory that may not
> be referenced in my database ( and therefore not visable in MythTV )
> and would like to verify and clean them out.

One approach would be to run the contrib script  
myth.rebuilddatabase.pl. It'll compare your recordings directory with  
the DB and ask if you want to recover any "lost" files. It also scans  
through your oldrecordings table for the names of shows so at least  
you know what they are. At that point you either bring them back or  
note the filename for later deletion.

The other way would be to simply rm anything that's not in the DB.  
This would work:

cd /myth/tv/recordings/dir
(ls; mysql --silent -u mythtv -pmythtv mythconverg -e "select  
basename from recorded") |
grep -v png$ |
sort |
uniq -u |
xargs rm

Here we list what's on the disk and what's in the DB, filter out  
preview images and files that appear in both places and delete the  
rest. I'd start by doing a test without the xargs rm!

Best bet is the rebuilddatabase script, much safer.

- George

More information about the mythtv-users mailing list