Following code shows how to create a Zip file and add files to it using Rebex ZIP component.
// open or create a ZIP archive and add files to it
using (ZipArchive archive = new ZipArchive(config.ZipArchivePath))
{
ArchiveOperationResult result = archive.Add(
"*",
@"\",
ArchiveTraversalMode.Recursive,
ArchiveActionOnExistingFile.OverwriteAll
);
Console.WriteLine(
"Added {0} file(s), {1} byte(s) to {2}.",
result.FilesAffected,
result.FilesUncompressedLength,
archive.FilePath
);
}