Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active December 23, 2021 07:00
Show Gist options
  • Save aspose-com-gists/b8d9c3e382160f4d615d320c0603a0a6 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/b8d9c3e382160f4d615d320c0603a0a6 to your computer and use it in GitHub Desktop.
Open or Extract 7z (7zip) File | Unzip 7z Programmatically using C# .NET
// Load password protected input 7z archive.
using(var archive = new SevenZipArchive("Sample_Encrypted.7z"))
{
// Extract or open 7z archive with password.
archive.ExtractToDirectory("Sample_Encrypted7zip", "aspose");
}
// Load input 7z (7zip) Archive with SevenZipArchive class.
using (SevenZipArchive archive = new SevenZipArchive("Sample.7z"))
{
// Extract all file in 7zip to a directory using ExtractToDirectory method.
archive.ExtractToDirectory(dataDir + "Sample_ExtractionFolder");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment