I use the following command to unrar all files in a rar-acrhive to a directory
unrar x -ep -y archive.rar folder
It works great and it ignores the directory structure inside the archive which is just what I want.
How do I make it unrar all rar files inside the archive aswell if there are any?
Run find folder -name "*.rar" -exec unrar ... "{}" folder \;
The "{}"
gets replaced with the name of the archive that find
found (unrar
will be called once per match). The \;
tells find
the end of the command to exec
ute.
Replace ...
with the options you want.
You can run that in a loop to do it until no archives are left:
while $(find folder -name "*.rar") != "" ; do
find folder -name "*.rar" -exec unrar ... "{}" folder \;
done
It's not extremely efficient if your archives are huge. For huge archives, you may want to cache the result of the first find
and use that in the loop instead of searching again.