Search code examples
.netzipdotnetzip

Is there any way to create an empty folder using DotNetZip?


I'm trying to use DotNetZip to create a zip file in C#.NET. However, I do need to include empty folders from time to time. Is this possible? Are there any tricks to make it happen?


Solution

  • There is an AddDirectory function:

    zipFile.AddDirectory("\\Your\Directory\Path\");
    

    I believe the empty directory must already exist at the location you are zipping from, so you may need to first create the empty directory on the server. Here are some examples.