Get in touch


Extract single file from zip archive on OS X

See how to quickly extract a single file from a huge zip archive

I recently needed to run a quick XML parsing test on a large XML file. I knew I had a very large (1,4GB) XML file in a zip archive and wanted to extract that file. Yet, in that zip archive sit millions of files and it takes about 30 minutes to extract the whole zip file.

If you want to list the contents of your zip file quickly on OS X, open the Terminal and type:

mactraveller: andre$ unzip -l Archive: Length Date Time Name -------- ---- ---- ---- 0 10-22-14 15:44 fcsvr_export/ 21508 10-23-14 01:00 fcsvr_export/.DS_Store 0 10-23-14 01:02 __MACOSX/ 0 10-23-14 01:02 __MACOSX/fcsvr_export/ 178 10-23-14 01:00 __MACOSX/fcsvr_export/._.DS_Store 76575 10-22-14 13:43 fcsvr_export/annotations.txt 178 10-22-14 13:43 __MACOSX/fcsvr_export/._annotations.txt 0 10-23-14 00:39 fcsvr_export/ASSET_XML/ 2493 10-22-14 14:45 fcsvr_export/ASSET_XML/100000.xml

As you see, this lists the contents of your zip file. Then locate the file you want to extract and type:

unzip fcsvr_export/ELEMENT_XML/elements.xml

This will extract a single file quickly.