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# Unrar (RAR Extractor or Opener) API – Free Download
- Unrar or Extract a Specific File from RAR in C#
- Extract or Unrar all Files from RAR in C#
- C# Unrar a Particular File from Password Protected RAR
- Unrar all Files from Password Protected RAR Archive in C#
- Get Free License
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:
- Load input RAR file with RarArchive class object.
- Create a file with Create() method.
- Open a specific entry from the RAR archive.
- 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:
- Load input RAR file.
- 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:
- Load the RAR file Encrypted with Password.
- Specify the file name for the output file.
- 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:
- Load an encrypted RAR file.
- 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.
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.