BASH Daily —List The Content Of Multiple ZIP Files
I was recently helping a family member with recovering some data from their backup files. It turned out that the backups were stored in multiple ZIP files. They were hundreds of them.
So how was I to list the content of all these ZIP files so that I could then pipe them to a grep (https://linux.die.net/man/1/grep) or awk (https://linux.die.net/man/1/awk) command to filter for the files I was looking for?
I did find that the command
unzip(https://linux.die.net/man/1/unzip) had an argument
-l that did just that; list out a list of the contents of a ZIP file. But there was another issue. The fact I had hundreds of them. So I just tried
unzip -l *.zip but it gave me this result for some reason (I was running out of time):
Not very helpful.
So I decided to code a solution with a loop… Anyways, here it is:
Here is an extract of the result: