Ubuntu – How to extract multiple zipped and rar files recursively

extracttarunzipzip

I have a folder ExampleFolder which contains many zipped folders. These zipped folders also contains multiple zipped folders. How to go through ExampleFolder and extract all of its zipped folders recursively?

Note that ExampleFolder itself, is not zipped, it's just a normal folder

Okay now I know what's happening Rinzwind and nux answers are both correct (except that I have to keep pressing Y or A forever)

But it's seems that some of the zipped files, contained zipped files and rar files as well, the rar files will not be extracted by

while [ "`find . -type f -name '*.zip' | wc -l`" -gt 0 ]; do find -type f -name "*.zip" -exec unzip -- '{}' \; -exec rm -- '{}' \;; done 

or whatever

Edit 2 Some files are named .r00 and r01, .r02 up to r14, they are rar files, but not .rar

Best Answer

  • You can use this command , it will recursively unzip all files in your current directory .

    Note This will delete original zipped files , but If you want to leave original files , delete -exec rm -- '{}' \; code .

    Command :

    while [ "`find . -type f -name '*.zip' | wc -l`" -gt 0 ]; do find -type f -name "*.zip" -exec unzip -- '{}' \; -exec rm -- '{}' \;; done