0

I have a file structure as so:

archive.zip contains:
    directory archive which contains:
        zip_1.zip contains:
            file.txt
        zip_2.zip
        zip_3.zip

Is there a way that I can extract file.txt without having to unzip archive.zip? I'm currently extracting zip_1.zip with

unzip -j archive.zip "archive/zip_1.zip" -d "/path/where/zip_1/will/go"

then extracting file.txt out of the resulting zip_1.zip .

Is there a clean way to extract file.txt in this situation?

  • due to the nature of zip, seeking the file appears to be mandatory. This precludes one-pass stream handling like with eg .tar.gz (using tar --to-stdout -xzf file.tar.gz innerfile.tar.gz | tar -xzf - ), even if unzip provides options -c and -p to extract to stdout. So beside a specialized program made at least in perl or python to store intermediate data in memory, this doesn't appear to be scriptable without using temporary files. – A.B Jun 26 '18 at 18:40
0

Here can be your solution using 7zip

  • Should have mentioned that I'm unable to use 7zip on the remote server, or else I would have followed that solution. – Michael Hackman Jun 26 '18 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.