I want to compress a file and a directory in C#. I found some solution in Internet but they are so complex and I couldn\'t run them in my project. Can anybody suggest me a clear
I'm adding this answer as I've found an easier way than any of the existing answers:
Code:
using (ZipFile zip = new ZipFile())
{
zip.AddFile("C:\test\test.txt");
zip.AddFile("C:\test\test2.txt");
zip.Save("C:\output.zip");
}
If you don't want the original folder structure mirrored in the zip file, then look at the overrides for AddFile() and AddFolder() etc.