Extract Nested ZIP Archives in C#

We often come across the scenario where multiple ZIP archives are encapsulated inside another ZIP. In such cases, first, you have to extract the parent ZIP and then the nested archives one by one. To make things easier for you, in this article, we will demonstrate how to extract the nested ZIP archives in C# .NET without writing complex code.

C# .NET API to Extract Nested ZIP Archives

To unzip the nested ZIP archives, we will utilize Aspose.ZIP for .NET. The API is designed to perform archiving operations from within the .NET applications. It allows you to create and manipulate popular archive formats seamlessly. You can either download the API’s DLL or install it using NuGet.

PM> Install-Package Aspose.Zip

Extract Nested ZIP Archives in C#

To demonstrate the extraction of nested ZIP archives, we have created the following ZIP file which contains 3 entries.

Nested ZIP Archives
Nested ZIP Archives

We will extract each nested ZIP archive and save its content in a separate folder. The following are the steps to extract nested ZIP archives in C#.

The following code sample shows how to unzip nested ZIP archives in C# .NET.

The following is the screenshot of the extracted ZIP archives.

Extracting nested ZIP archives in C# .NET
Unzipped Nested Archives

Get a Free API License

You can get a free temporary license to use Aspose.ZIP for .NET without evaluation limitations.

Conclusion

In this article, you have learned how to extract nested ZIP archives in C#. The step-by-step guide and code sample have demonstrated how to unzip each nested archive into a separate folder. Besides, you can visit documentation to explore other features of Aspose.ZIP for .NET. Also, you can ask your questions via our forum.

See Also