Originally published January 24, 2021 @ 3:30 pm

Just a straightforward wrapper script for the unrar command that allows extracting specified filetypes from multipart archives while utilizing all available CPU cores.

Seriously, who memorizes unrar command-line options? This little script will locate all *.rar files in the current folder. It will then extract specified filetypes from single- or multi-part archives using all the CPU cores on your system.

#!/bin/bash
find . -type f -regextype posix-extended \
-regex '^.*(part(0)?1|[[:alpha:]]|[@_\-\.;\:\^\%$\#\!=+~`])\.rar$' -print0 | \
xargs -0 -n1 -P$(grep -c proc /proc/cpuinfo) -I% unrar e -kb -o+ % \*.{pdf,epub,mkv,avi,mp4,mp3,flac}