User Tools

Site Tools


linux:unrar_multiple_archived

Unrar multiple archives from multiple folders

09.07.2010

If you have a bunch of folders with multiple volumes archive in them, there is a simple way to extract the information using bash.

First, let's assume we have a structure like this (folders):

Some.TVSeries.S02E01.DVDRip.XviD
Some.TVSeries.S02E02.DVDRip.XviD
Some.TVSeries.S02E03.DVDRip.XviD

and each of them follow the pattern (files):

$ ls Some.TVSeries.S02E01.DVDRip.XviD
sometv-201.r01
sometv-201.r02
sometv-201.r03
...
sometv-201.rar

The extract command is:

unrar e Some.TVSeries.S02E01.DVDRip.XviD/sometv-201.rar /folder/extracted/content

but you try to avoid doing so for each folder you have. So, the solution is (we assume that we have 12 identical pattern folders):

for r in $(seq 1 12); do a=`printf '%.02d' $r`; unrar e Some.TVSeries.S02E$a.DVDRip.XviD/sometv-2$a.rar /folder/extracted/content; done

Note: We're using here printf to get numbers as 01, 02 … 12 (with the leading 0).

linux/unrar_multiple_archived.txt · Last modified: 2013/03/16 17:40 (external edit)