I want to download and extract a large zip archive (>180 GB) containing multiple small files of a single file format onto an SSD, but I don't have enough storage for both the zip archive and the extracted contents. I know that it would be possible to extract and delete individual files from an archive using the zip command as mentioned in the answers here and here. I could also get the names of all the files in an archive using the unzip -l
command, store the results in an array as mentioned here, filter out the unnecessary values using the method given here, and iterate over them in BASH as mentioned here. So, the final logic would look something like this:
- List the zip file's contents using
unzip -l
and store the filenames in a bash array, using regular expressions to match the single file extension present in the archive. - Iterate over the array of filenames and successively extract and delete individual files using the
unzip -j -d
andzip -d
commands.
How feasible is this method in terms of time required, logic complexity, and computational resources? I am worried about the efficiency of deleting and extracting single files, especially with such a large archive. If you have any feedback or comments about this approach, I would love to hear them. Thank you all in advance for your help.
gz
) I have my doubts this will work with multyfile structure aszip