Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
45
rated 0 times [  45] [ 0]  / answers: 1 / hits: 21358  / 1 Year ago, thu, april 13, 2023, 2:54:38

I have more than 200 .zip files in one folder. I don't want to decompress those one by one. I want to extract those using single command or script. How to do that.


More From » bash

 Answers
4

If you really want to uncompress them in parallel, you could do



for i in *zip; do unzip "$i" & done


That however, will launch N processes for N .zip files and could be very heavy on your system. For a more controlled approach, launching only 10 parallel processes at a time, try this:



find . -name '*.zip' -print0 | xargs -0 -I {} -P 10 unzip {}


To control the number of parallel processes launched, change -P to whatever you want. If you don't want recurse into subdirectories, do this instead:



find . -maxdepth 1 -name '*.zip' -print0 | xargs -0 -I {} -P 10 unzip {}


Alternatively, you can install GNU parallel as suggested by @OleTange in the comments and run



parallel unzip ::: *zip

[#26624] Saturday, April 15, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nquirewha

Total Points: 256
Total Questions: 109
Total Answers: 122

Location: Namibia
Member since Mon, Feb 21, 2022
2 Years ago
nquirewha questions
Wed, Jan 26, 22, 03:38, 2 Years ago
Mon, Nov 1, 21, 13:50, 3 Years ago
Thu, Dec 1, 22, 09:23, 1 Year ago
;