Skip to content

Small rar unpack script

The rar unpack script has only been tested on OSX, but should go also in FreeBSD or other Unix like OS’s. 🙂

So I have recently found my self using to much time unpacking directories with massive amounts of rar files. They are named like
name.r01
name.r02
etc. etc.
name.rar

Each file is 50MB in size, so its a bit of a hazzle to go in to each folder locate the .rar file, extract it into the destination folder and so on.

So this script rely on the commandline tool rar and unrar from rarlab downloadable from http://www.rarlab.com/download.htm

Please follow license and payment for it.

Unpack the files rar and unrar into /usr/local/bin
Be sure to have that /usr/local/bin in the PATH

The following script are to be used as-is. Use it as it is or use it as inspiration for your own workflow.
Save it as what-ever-name-you.like.sh in to /usr/local/bin
Use it by cd to the destination folder and run the script with the command

$ what-ever-name-you.like.sh path-to-topfolder-of-rar-folders

#!/bin/bash
find $@ -name "*.rar" >> /tmp/log.txt
while read RARFILE; do
unrar e $RARFILE
done < /tmp/log.txt
rm -f /tmp/log.txt
echo "Unrar service done.!!"
exit 0
Published inAppleBSDScripting

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *