# Multiple files in a gzip archive

**URL:** <https://discourse.julialang.org/t/multiple-files-in-a-gzip-archive/4261>\
**Category:** General Usage\
**Created:** [June 14, 2017, 5:22am UTC](https://discourse.julialang.org/t/multiple-files-in-a-gzip-archive/4261 "2017-06-14T05:22:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcnlee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rcnlee/32/4107_2.png) [@rcnlee](https://discourse.julialang.org/u/rcnlee)\
**Post date:** [June 14, 2017, 5:22am UTC](https://discourse.julialang.org/t/multiple-files-in-a-gzip-archive/4261/1 "2017-06-14T05:22:10Z")

</div>

Is it possible to create a single compressed archive that contains a number of text or csv files? It looks like gzip.jl only zips a single file at a time.

Thanks!

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [June 14, 2017, 5:25am UTC](https://discourse.julialang.org/t/multiple-files-in-a-gzip-archive/4261/2 "2017-06-14T05:25:45Z")

</div>

The `gzip` format has no support for multiple files (like `.zip`), so the answer is no.

What are you trying to achieve? If you can save your data in HDF5/JLD, you can create complex hierarchies (resembling a file system).

---

<div class="post-metadata">

**Author:** ![kevin.squire](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin.squire/32/62_2.png) [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)\
**Post date:** [June 14, 2017, 5:40am UTC](https://discourse.julialang.org/t/multiple-files-in-a-gzip-archive/4261/3 "2017-06-14T05:40:32Z")

</div>

HDF5/JLD is a probably a good suggestion, although that might depend on your use case.

If you really want to work with a archive with multiple files, you can try [ZipFile.jl](https://github.com/fhs/ZipFile.jl)

Cheers,  
Kevin

---

<div class="post-metadata">

**Author:** ![rcnlee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rcnlee/32/4107_2.png) [@rcnlee](https://discourse.julialang.org/u/rcnlee)\
**Post date:** [June 14, 2017, 5:41am UTC](https://discourse.julialang.org/t/multiple-files-in-a-gzip-archive/4261/4 "2017-06-14T05:41:12Z")

</div>

I have a number of log files in csv format that I would like to compress into a single archive. I’d like to pick a compressed archive format where the user can easily unzip it and inspect the files. Ideally, the format should be something standard and not depend on Julia.

Looks like ZipFile might be a good way to go?  
[https://zipfilejl.readthedocs.io/en/latest/](https://zipfilejl.readthedocs.io/en/latest/)

Ritchie

---

<div class="post-metadata">

**Author:** ![rcnlee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rcnlee/32/4107_2.png) [@rcnlee](https://discourse.julialang.org/u/rcnlee)\
**Post date:** [June 14, 2017, 5:41am UTC](https://discourse.julialang.org/t/multiple-files-in-a-gzip-archive/4261/5 "2017-06-14T05:41:47Z")

</div>

Ah, thanks Kevin!

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [June 15, 2017, 12:34am UTC](https://discourse.julialang.org/t/multiple-files-in-a-gzip-archive/4261/6 "2017-06-15T00:34:37Z")

</div>

Typically, multiple files are stored together using the `tar` format, and then gzipped.  
The advice I found (although it was from 2015) was to use the `tar` command by using `run(...)` to untar all the files into a directory (after uncompressing)  
[https://github.com/fhs/ZipFile.jl](https://github.com/fhs/ZipFile.jl) does look good, but I don’t know how maintained it is.

---

<div class="post-metadata">

**Author:** ![js135005](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/js135005/32/8219_2.png) [@js135005](https://discourse.julialang.org/u/js135005)\
**Post date:** [June 15, 2017, 2:14am UTC](https://discourse.julialang.org/t/multiple-files-in-a-gzip-archive/4261/7 "2017-06-15T02:14:16Z")

</div>

Functionally ZipFile.jl works quite nicely. However it seems quite slow - about 20x slower than reading uncompressed files directly. I’m looking to build something similar but using Libz.jl as its base (similar to BGZFStreams.jl). In tests I ran using Libz.jl to read gzip files, the slowdown compared to reading uncompressed files was only about 10% or so - excellent! Not sure how quickly I can get to writing the ZipFile.jl replacement but I really need it in my work soon.
