[mythtv-users] Deleting orphaned recordings
Michael T. Dean
mtdean at thirdcontact.com
Sun Apr 2 17:20:40 UTC 2006
On 04/01/2006 07:49 PM, Kyle Gordon wrote:
> Recently I had a filesystem go offline on me whilst I was clearing out my
> MythTV recordings. No errors were reported until I went to use the
> filesystem, and consequently recordings that have been 'deleted' by MythTV
> are still on the filesystem, yet are gone from the database.
>
> Is there any way to find what ones are orphaned, and delete them? I'm using
> MythTV 0.19 on Debian here.
>
How about
mysql -umythtv -p mythconverg -B \
-e 'SELECT basename FROM recorded;' > ~/files
ls | grep -vf ~/files | grep -v 'nfslockfile.lock'
However, if you happen to have an orphaned recording called basename, it
won't show up in the list, in which case, you can change the SELECT
statement to 'SElECT basename AS SomethingThatsNotAFilename FROM
recorded;'. I don't know how (or even if it's possible) to prevent
MySQL from putting a column title above the list of data.
Note that the output will contain any file or directory name that's not
a recording (or a thumbnail for a recording or the nfslockfile.lock).
If you have your recordings in a directory with nothing else, it will
show you only orphans.
If you're content with the results, you can automate the deletion.
However, since I think human interaction is more appropriate, I won't
show how. ;) If nothing else, you can add "> ~/orphans" to the end of
the "ls" line and use a text editor to insert "rm " at the beginning of
every line and then run it as a script (or copy/paste the lines over to
a shell), but I take no responsibility for the results of doing so.
Mike
More information about the mythtv-users
mailing list