title: Recursively unzip all subdirectories while retaining file structure
body: <p>I'm new to bash scripting, and i'm finding it hard to solve this one.</p>
  <p>I have a parent folder containing a mixture of sub directories and zipped sub directories.</p>
  <p>Within those sub directories are also more nested zip files.</p>
  <p>Not only are there .zip files, but also .rar and .7z files which also contain nested zips/rars/7zs.</p>
  <p>I want to unzip, unrar and un7z all my nested sub directories recursively until the parent folder no longer contains any .rar, .zip, .7zip files. (these eventually need to be removed when they have been extracted). There could be thousands of sub directories all at different nesting depths. You could have zipped folders or zipped files.</p>
  <p>However I want to retain my folder structure, so the unzipped folders must stay in the same place where it has been unzipped</p>
  <p>I have tried this script that works for unzipping, but it does not retain the file structure.</p>
  <pre><code>#!/bin/bash
  
  while [ &quot;`find . -type f -name '*.zip' | wc -l`&quot; -gt 0 ]
  
  do
      find . -type f -name &quot;*.zip&quot; -exec unzip -- '{}' \; -exec rm -- '{}' \;
  done
  
                               
  </code></pre>
  <p>I want for example:</p>
  <p>folder 'a' contain zipped folder 'b.zip' which contains a zipped text file pear.zip (which is pear.txt that has been zipped to pear.zip a/b.zip(/pear.zip))</p>
  <p>I would like folder 'a' to contain 'b' to contain pear.txt 'a/b/pear.txt'</p>
  <p>The script above brings 'b' (b is empty) and pear both into folder 'a' where the script is executed which is not what I want. eg 'a/b' and 'a/pear.txt'</p>