# File zipping taking longer for large files

**URL:** <https://discourse.julialang.org/t/file-zipping-taking-longer-for-large-files/115963>\
**Category:** Performance\
**Tags:** zip\
**Created:** [June 21, 2024, 6:35am UTC](https://discourse.julialang.org/t/file-zipping-taking-longer-for-large-files/115963 "2024-06-21T06:35:04Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Sandy45](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@Sandy45](https://discourse.julialang.org/u/Sandy45)\
**Post date:** [June 21, 2024, 6:35am UTC](https://discourse.julialang.org/t/file-zipping-taking-longer-for-large-files/115963/1 "2024-06-21T06:35:04Z")

</div>

I am trying to zip files in the directory which is around 300 - 400 MB and it’s taking more than 15 mins to finish. Initially I was using custom function written using ZipFile package. I have tried using Base.zip which isn’t helpful and even tried zip\_files method from ZipStreams package. This was working fine but zipped file will be having sub-directories if input path provided consists of sub-directories. I have tried to use zipsink as well but no luck. Any suggestions?

```julia
function zip(archive_name::String, files::Vector{Any}=String[])
    @info "Zip all files"
    isempty(files) && return
    w = ZipFile.Writer(archive_name)
    for file in files
        @show file
        ff = split(file, "/")
        ff= length(ff) > 3 ? ff[4] : ff[3]
        f = ZipFile.addfile(w, ff, method=ZipFile.Deflate)
        write(f, read(file, String))
    end
    close(w)
end

```

---

_[View the full topic](https://discourse.julialang.org/t/file-zipping-taking-longer-for-large-files/115963)._
