Unrar Extract Files Csharp

You can store multiple files in compressed form as RAR archive. In this article, you will learn how to Unrar or extract files from a compressed RAR archive in C# .NET. Please find further details in the following sections:

C# RAR Extractor or Opener to Unrar RAR4 RAR5 – Free Download

Aspose.ZIP for .NET API supports archiving and extracting files from compressed formats like RAR (RAR4, RAR5), ZIP, 7Z, etc. You can install the API by downloading it from the Downloads section, or you can configure it with the following command using Package Manager Console in Microsoft Visual Studio:

PM> Install-Package Aspose.Zip

Unrar a File from RAR in C#

You can unrar or extract a specific file from a RAR archive with the following steps:

  1. Load input RAR file with RarArchive class object.
  2. Create a file with Create() method.
  3. Open a specific entry from the RAR archive.
  4. Write extracted data to a file.

The code below shows how to unrar or extract a specific file from RAR archive programmatically with C#:

Extract All Files from RAR Archive in C#

You can unrar or extract all the files from a RAR archive in C# with the following steps:

  1. Load input RAR file.
  2. Extract all the files to a directory.

The following code shows how to unrar all files from RAR archive programmatically in C#:

C# Unrar a Particular File from Password Protected RAR

You can unrar a particular file from a password protected RAR archive with the steps below:

  1. Load the RAR file Encrypted with Password.
  2. Specify the file name for the output file.
  3. Unrar the password-protected file with Extract() method.

The following code explains how to unrar a particular file from a password protected or encrypted archive in C#:

C# Unrar all Files from Password Protected RAR Archive

You can extract all the files from a password encrypted RAR archive in C# with below steps:

  1. Load an encrypted RAR file.
  2. Unrar or extract password-protected files from the archive.

The following code snippet shows how to unrar all files from a password encrypted RAR file programmatically in C#:

C# .NET Unrar API - Get a Free License

You can evaluate the API without any limitations by applying for a Free Temporary License.

Conclusion

In this article, you have learned all the use cases about how to unrar or extract files from the RAR archive in C#. It also discusses the scenario when the RAR file is encrypted with password protection where you can extract a specific file or all the files into a directory in C#. Furthermore, you may visit API Documentation to check out several other features. Please feel free to contact us at the Free Support Forum for any queries.

See Also