Unrar TV show packs

We all download TV shows, there is no use denying it. I recently got pointed in the directory of a rather funny show called The Big Bang Theory. I grabbed the first episode of season 1, saw what I liked, then grabbed the entire season 1 pack.

17 episodes, each in their own folder in .rar files.
What a pain in the ass!

Instead of clicking away at each RAR file individually, I put together a little bash script to do the work for me which I’ve called unrar_all.

#!/bin/bash
#
# Script to unrar season packs of TV shows
# Put it in the directory containing all the directorys
#
# eg.
#       Big_Bang_Theory.1x01.Pilot.DVDRip_XviD-FoV/
#       Big_Bang_Theory.1x02.The_Big_Bran_Hypothesis.DVDRip_XviD-FoV/
#       Big_Bang_Theory.1x03.The_Fuzzy_Boots_Corollary.DVDRip_XviD-FoV/
#       unrar_all
 
 
find . -type d -print | while read i
        do pushd .
        cd $i
                unset partrar
                partrar=`find . -name *part01.rar`
                if [ -n "$partrar" ]; then
                unrar e *part01.rar
                mv *.avi ../
                popd
        else
                unrar e *.rar
                mv *.avi ../
                popd
        fi
done

This script requires unrar from RARLabs.

7 thoughts on “Unrar TV show packs

  1. Pingback: mathiaswiberg.se » unrar bashscript

  2. I like to watch Veronica Mars episodes as well Lost. I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep up the good work. Look forward to reading more from you in the future.

  3. Here’s my one line equivalent as I’m even lazier this command is usually in my bash history I can just rerun it with !xxx

    for i in */*.rar; do if [[ $i == *part*rar ]]; then if [[ $i == *part*01.rar ]]; then unrar x “$i”; fi; else unrar x “$i”; fi done

    Good seeing u at ruxcon dude 🙂

    PS damnit now I need to change my blogsite wordpress theme.

  4. I just stumbled over this website when trying to find an easy way to unpack my tv shows, but I have no experience with bash scripts. So how can I turn this script into an executable that could be launched from my folder? If it’s too much of a bother, I’ll go somewhere else 🙂

Leave a Reply

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


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.