I have a cron job which runs a script to unrar all files in a certain directory (/rared for argument's sake) and place the expanded files in /unrared. I would like to change this script so that it deletes the original rar archives from /rared only if they successfully extracted.
This does not mean that unrar has reported that they have been fully extracted, because I have had data corruption during decompression before.
Ideally (pie-in-the-sky, just to give you an idea of what I'm shooting for,) the unrar program would include this functionality, comparing an expected md5sum value with the actual md5sum value and only deleting the archive if they match. I don't mind scripting this entire process if I have to, but there must be a better way than unraring twice and comparing md5sums.