Listing files without unzipping and selective unzip - 7zip

We have several big sized zip files. Each of these zips contains excel file and a bunch of bmp images.
I was just wondering if 7-zip allows listing the content of the zip without unzipping it? And also if we can selectively unzip the excel file?
Currently, I use c# console program utilizing diagnostic process to execute 7z.exe. It would be nice not to unzip the entire thing.

For listing you can use the list command (l) to the 7zip.exe
7z l archive.zip
For selectively extracting files you can use different commands to the extract command. Something like:
7z e archive.zip -oc:\soft *.xls

Related

Extract only files with specific extension via bash

For a first time I need to create an .sh for do something. My aim is to unzip a lot of zip folders, so I've wrote the script below:
for zipfiles in /downloads/*.zip; do unzip $zipfiles; done
I can unzip all but I noticed that there are some files with the same name and typing y I can ultimate the process.
There is a way to extract only files with a specific extension, like .docx, instead of the entire zip folder? I'm absolutely sure that there aren't .docx with the same name.
You can specify a pattern:
for zipfiles in /downloads/*.zip; do unzip "$zipfiles" '*.docx'; done
Tested to work with UnZip 6.00.
You can also specify the -x option to exclude.
try this one, it can be useful for your purpose.
for zipfiles in /downloads/*.zip; do unzip -xo "$zipfiles" '*.docx' ; done
by this option overwrite files WITHOUT prompting.

How to delete source zip files while using ditto command on Mac?

I have several Zip folders (produced by Google Takeout service) and I want to merge them since Google provides many small Zips as an output. For the sake of merging I've chosen to use ditto command on Mac, which will merge all files/folders including the metadata.
Now, the problem I have is this: ditto command creates another copy of the source zip file and places it into destination folder. I would like this source zip file to be deleted after extraction and have no copy of the zip added to the destination folder due to the limited size of the HDD. Each of 35 Zip files weights about 50Gb. Any ideas how I should alter my command?
So far my intended line of command would be:
ditto -x -k -V *.zip result 1>log.txt 2>&1

How to extract a zipped folder that was split into multiple parts in MAC OS

I downloaded a big folder in Google Drive that was split into 5 parts:
Myfolder-20200911T192019Z-001.zip
Myfolder-20200911T192019Z-002.zip
Myfolder-20200911T192019Z-003.zip
Myfolder-20200911T192019Z-004.zip
Myfolder-20200911T192019Z-005.zip
I'm having some trouble to extract it into the single folder it originally is. Is there a straighforward way to unzip all of them together and recreate the original folder? Maybe some specific command in gzip? I didn't wish to install any program just to perform this task.
The above answer didn't work for me.
The files needed to be unzipped sequentially rather than just concatenated together.
For anyone coming here from a general search about combining zip files but specifically to combine multipart zips from Google Drive, I found this answer to be the one that worked:
https://superuser.com/questions/1255221/how-to-unzip-multiple-zip-files-into-a-single-directory-structure-e-g-google-d
i.e. for the above (creating an output directory to start with if necessary):
mkdir outputFolder
unzip "Myfolder-20200911T192019Z-00*" -d outputFolder
You can do cat Myfolder-20200911T192019Z* > total.zip to combine your zip files and then run unzip total.zip

unix unzip utility: is there a way to give the extracted folder a different name than the zip file name?

I can do the command:
unzip some-zip.zip
and it will produce a some-zip folder.
I don't want a default folder name, but to create my own. Nor do I want to do a mv after.
I don't see a command line option to handle this. Can I accomplish this easily with redirection (if indeed no command line option)? If so, will that work efficiently for a fairly large zip file (52 MB)?
Thanks
unzip file.zip -d destination_folder

Installer for a .bin file that will run on Ubuntu

I have a .bin file that will comprise of 3 files
1. tar.gz file
2. .zip file
3. install.sh file
For now the install.sh file is empty. I am trying to write a shell script that should be able to extract the .zip file and copy the tar.gz file to a specific location when the *.bin file is executed on an Ubuntu machine. There is a Jenkins job that will pull in these 3 files to create the *.bin file
My Question is how do I access the tar.gz and .zip file from my shell script ?
There are two general tricks that I'm aware of for this sort of thing.
The first is to use a file format that will ignore invalid data and find the correct file contents automatically (I believe zip is one such format/tool).
When this is the case you just run the tool on the packed/concatenated file and let the tool do its job.
For formats and tools where that doesn't work and/or isn't possible the general trick is to embed markers in the concatenated file such that the original script ignores the data but can operate on itself to "extract" the embedded data so the other tool can operate on the extracted contents.

Resources