Friday, September 19, 2014

How to extract a specific file from zip?

Lets say I have a zip file "my-archive.zip" and I want to extract only "c.zip" file from it.

First check the zip content with below content

unzip -l "my-archive.zip"

Archive:  my-archive.zip 

  Length      Date    Time    Name
---------  ---------- -----   ----
     2213  09-17-2014 15:57  a.zip
     1591  09-17-2014 15:57   b.zip
     4005  09-17-2014 15:57   c.zip
     6966  09-18-2014 14:07   d.zip
---------                     -------
   13182                     4 files
     

And now to extract only "c.zip"

unzip -j "my-archive.zip" "c.zip" -d tmp

Where it extracted "c.zip" to "tmp" directory

No comments: