Skip to content

Instantly share code, notes, and snippets.

View aspose-zip-gists's full-sized avatar

aspose-zip-gists

View GitHub Profile
IArchive archive = new Archive("archive.zip");
archive.ExtractToDirectory("D:\\")
@aspose-zip-gists
aspose-zip-gists / UniversalCompressor.cs
Last active March 15, 2024 04:43
UniversalCompressor
string directoryPath = @"C:\path\to\your\directory";
ArchiveInfo.ArchiveFormat format = ArchiveInfo.ArchiveFormat.Zip;
ArchiveFactory.CompressDirectory(directoryPath, format);
using (var archive = new Archive())
{
archive.CreateEntries(@"D:\BigFolder");
EventsBag eb = new EventsBag();
eb.EntryCompressed += delegate(object sender, CancelEntryEventArgs args)
{
if (args.Entry.Name == @"BigFolder\last.bin"))
args.Cancel = true;
};
archive.Save("output.zip", new ArchiveSaveOptions() { EventsBag = eb });