Script / App to unRAR files, and only delete the archives which were sucessfully expanded.

Posted by Jeremy on Ask Ubuntu See other posts from Ask Ubuntu or by Jeremy
Published on 2010-10-14T05:57:23Z Indexed on 2011/01/09 10:58 UTC
Read the original article Hit count: 286

Filed under:
|

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.

© Ask Ubuntu or respective owner

Related posts about scripts

Related posts about automation