[Solved] C# How to create a zip file from 3 directory contents [closed]


Try DotNetZip library. DotNetZip

Here is a very simple example:

ZipFile zipFile = new ZipFile();
zipFile.AddFile("{path}/file.txt");
zipFile.Save("{path}/filename.zip");
zipFile.Dispose();

For doing this with files in a directory you can use

string [] files = Directory.GetFiles("directoryPath", "*.txt");

And add to zipFile instance each file in the array. Notice: Second parameter in Directory.GetFiles function is the search pattern

1

solved C# How to create a zip file from 3 directory contents [closed]