unzip .zip file and list the files included in the .zip archive
I am trying to return the name of the resulting file from a .zip archive file using unix unzip command.
SecureZIP for z/OS by PKWARE
I used the following command to unzip in quite mode (-q), without making directories(-j) and overwrite existing files(-o)
unzip - qjo c07212007.cef7081.zip
The above cmd unzippes the file "G0063V00" in the current working directory.
In addition to unzipping the file in the current working dir, I would like to store the filename resulting filename "G0063V00" in a variable for further processing. How do I get the filename that was just unzipped ? I tried using -l option but I get a lot more information than needed.
unzip -qjol c07212007.cef7081.zip
Length Date Time Name
-------- ---- ---- ----
265 07-22-07 03:32 CEP/CEM7080/PPVBILL/PASS/G0063V00
265 1 file
So I tried the following:
basename "`unzip -qojl c07212007.cef7081.zip`"
265 1 file
As you see, I still get more information than I need. I just want to return the filename which in this case is "G0063V00".