I'm writing an AppleScript to watch a folder for completed downloads, then process them. If I'm downloading a file split across partial RARs (.r01, .r02, … God I hate those), they'll enter the Completed folder randomly as they're completed. The script will trigger every time one of them is completed, but I don't want it to start to auto-unarchive until all of them are done.
So here's my solution. In the script, when I detect a rar, I first verify it for completeness:
do shell script ("unrar v " & theItem)
The shell will spit out, among other things, this:
… Testing archive thefile.r19 96% … Testing archive thefile.r20 99% ... Calculating control sums of all volumes. Cannot find volume thefile.r21 … thefile.avi - CRC failed Total errors: 1
I'm new to AppleScript. What's the most efficient way to scan through that and determine if the verification has failed?
unrar v is time consuming; is there any better way to approach this problem?)