Avatar of buttonMASTER

asked on 

Unix commands to unzip a bunch of zip files scattered in folders (and other requirements)?

I need to extract a bunch of zip files, but I have requirements.

The zip files are scattered in various folder like this

  • base_folder/
  • base_folder/batch_1/batch_1_1.zip
  • base_folder/batch_1/batch_1_2.zip
  • base_folder/batch_2/batch_2_1.zip
  • base_folder/batch_2/batch_2_2.zip
  • base_folder/batch_2/batch_2_1.zip
  • base_folder/big_batch/batch_a/batch_a_1.zip
  • base_folder/big_batch/batch_a/batch_a_2.zip
  • base_folder/big_batch/batch_b/batch_b.zip

I want to extract the files to another folder and keep the same folder structure

  • base_folder/extracted/
  • base_folder/extracted/batch_1/file_1
  • base_folder/extracted/batch_1/file_2
  • base_folder/extracted/batch_2/file_2_1
  • base_folder/extracted/batch_2/file_2_2
  • base_folder/extracted/batch_2/file_2_1
  • base_folder/extracted/big_batch/batch_a/file_a_1
  • base_folder/extracted/big_batch/batch_a/file_a_2
  • base_folder/extracted/big_batch/batch_b/file_b

I want to extract everything in the zip file except for files that have certain extensions

  • file - OK
  • file.exe - OK
  • file.xml - OK
  • file.txt - Not OK
  • file.xls - Not OK

Is this possible with a few Unix commands? If it isn't entirely possible, what is the closest I can do?
Unix OS

Avatar of undefined
Last Comment

8/22/2022 - Mon