---
title: "Read a split RAR archive in C#"
url: https://recursiveai.org/onearchive/cookbook/list-multi-volume-rar-entries/
description: "List entries across a split RAR 5 archive in C#. Open the first part and let OneArchive find the rest, without joining files or extracting them."
version: "1.2.0"
---

# Read a split RAR archive in C#

**OneArchive** is a free, open-source archive and compression library for .NET from Recursive AI: zip, tar, 7z, RAR and more in RecursiveAI.OneArchive, with compression codecs in RecursiveAI.OneCompress. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneArchive) · [GitHub](https://github.com/recursive-ai-oss/onearchive-csharp) · [Docs](https://recursiveai.org/onearchive/docs/) · [Download example (.zip)](https://recursiveai.org/onearchive/cookbook/list-multi-volume-rar-entries/list-multi-volume-rar-entries.zip)

OneArchive reads RAR 5 only: it lists stored and compressed entries but extracts only stored (uncompressed) files. Keep all eight sample parts in one folder and open `vol.part1.rar`.

Opening RAR 4 throws `RarUnsupportedException` with `Kind` set to `Rar4Archive`. The filename doesn’t tell you the version: in a hex viewer, look for the RAR 4 signature `52 61 72 21 1A 07 00` or the RAR 5 signature `52 61 72 21 1A 07 01 00`. In a self-extracting archive, the signature comes after the executable stub.

```shell
dotnet add package RecursiveAI.OneArchive
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using RecursiveAI.OneArchive;

using var rar = Archive.Open("vol.part1.rar");
foreach (var entry in rar.EnumerateEntries())
    Console.WriteLine($"{entry.Name}: {entry.Size} bytes");
```

Paste the code above into Program.cs of a new `dotnet new console` project and `dotnet run`, or unzip [the example](https://recursiveai.org/onearchive/cookbook/list-multi-volume-rar-entries/list-multi-volume-rar-entries.zip) and `dotnet run`.

```text
big.bin: 300000 bytes
hello.txt: 920 bytes
```

The example lists `big.bin` once, even though its 300,000 bytes span all eight volumes, then lists `hello.txt` (920 bytes) from the last volume. No files are extracted.

If a part is missing, the listing can print earlier entries before throwing `CompressionFormatException` with `IsTruncated` set.

## Variations

**Supply each volume as a stream.** Give `RarReader` the first part yourself. Its callback takes a zero-based volume index, so index 1 is `vol.part2.rar`. This example opens the same files as the first snippet; return `null` if the requested part is missing.

```csharp
using RecursiveAI.OneArchive.Rar;

using var rar = new RarReader(File.OpenRead("vol.part1.rar"),
    new RarReaderOptions
    {
        Volumes = index =>
        {
            string path = $"vol.part{index + 1}.rar";
            return File.Exists(path) ? File.OpenRead(path) : null;
        }
    });
while (rar.GetNextEntry() is { } entry)
    Console.WriteLine($"{entry.Name}: {entry.Size} bytes");
```

```text
big.bin: 300000 bytes
hello.txt: 920 bytes
```

## Related recipes

- [List RAR 5 entries and extract a stored file](https://recursiveai.org/onearchive/cookbook/list-rar5-and-extract-stored-entry/)
- [Open a large ZIP](https://recursiveai.org/onearchive/cookbook/open-large-zip/)

---

## The short answer

Pass the first RAR 5 volume’s path to `Archive.Open` and loop over `EnumerateEntries()`. As the listing moves forward, OneArchive opens the next parts from disk and follows any file that continues across them. You get one entry per file, not one per part. The listing doesn’t need an output folder or a combined archive file.

## How do I open a multipart RAR archive?

Put the full set in the same directory and keep the original names. Start with `name.part1.rar` (or `name.part01.rar` if the archive uses two digits), not the last part or whichever file happened to finish downloading first. For older-style filenames, start with `name.rar`; the other volumes are `name.r00`, `name.r01`, and so on. The [RAR reader docs](https://recursiveai.org/onearchive/docs/rar-reader/#volumes) describe both naming schemes. That older filename pattern does not mean OneArchive can open the old RAR 4 format: the archive still needs to be RAR 5.

Keep reading to the end if you need a complete inventory. Opening the first volume doesn’t prove that the rest are present. The reader finds out when it needs the next volume, and checks that the part it opens has the expected volume number. Don’t treat the names printed before a missing-part error as a complete result. If you’ve been given only the latter half of a set, retrieve the earlier parts rather than renaming a later part to look like the first.

## How do I see what’s inside a RAR file without extracting it?

Read the entries and use their names and declared sizes. A RAR 5 archive can contain compressed files OneArchive can list but cannot decode. The sizes in the listing describe the unpacked entries in the example, not the size of each `.rar` file on disk. Listing doesn’t validate the contents of each file or tell you that every listed entry can be extracted. An archive with encrypted headers can’t be listed by this reader, and encrypted entry data can’t be extracted.

If the volumes come from a place other than one directory, use `RarReader` with `RarReaderOptions.Volumes` to provide the requested part as a stream. Pass the first volume separately; the callback supplies subsequent volumes by number and returns `null` for a missing part. Use the path-based API when the volumes are already on disk with their original names—it takes care of that lookup for you.
