How Unrar Handles Case Sensitivity on Windows vs Linux

When extracting archives containing files with mixed or colliding letter casing, unrar behaves differently on Windows and Linux due to the underlying filesystem architectures. While Linux natively supports case-sensitive filenames, allowing files like file.txt and FILE.txt to coexist in the same directory, Windows is case-insensitive by default. Consequently, unrar adapts its extraction logic to the host operating system, seamlessly writing distinct files on Linux while triggering collision and overwrite mechanisms on Windows.

Filesystem Foundations: POSIX vs. Windows

The core difference in how unrar behaves stems from how each operating system interacts with its filesystem:

  • Linux (ext4, Btrfs, XFS): POSIX-compliant filesystems treat uppercase and lowercase characters as distinct byte values. As a result, Document.txt and document.txt are recognized as two independent files.
  • Windows (NTFS, FAT32): Although NTFS is case-preserving (it remembers whether a letter was typed in uppercase or lowercase), it is case-insensitive by default at the Win32 API layer. Requesting access to Document.txt points to the exact same file record as document.txt.

How Unrar Behaves on Linux

When running unrar on a Linux system, the utility relies directly on the operating system’s case-sensitive system calls.

If an archive contains two files whose names differ only by letter case—such as Data.csv and data.csv—unrar extracts both without issue. Neither file will overwrite the other, and no user prompt is triggered. The extracted output directly mirrors the distinct file entries stored inside the RAR archive.

How Unrar Behaves on Windows

When extracting that same archive on Windows, unrar encounters a conflict. Because Windows sees Data.csv and data.csv as identical target paths, attempting to extract the second file points directly to the file that was just created.

In standard interactive mode, unrar recognizes that a file matching the target name already exists on disk. It will pause extraction and present an overwrite prompt:

data.csv already exists. Overwrite it ?
[Y]es, [N]o, [A]ll, n[E]ver, [R]ename, [Q]uit

If the extraction is automated or run in non-interactive mode without collision flags, the default behavior depends on the specified switches:

  • Without flags, the process may stall or fail on the duplicate entry.
  • If forced to overwrite (via -o+), the second file silently replaces the first file, resulting in data loss.
  • If forced not to overwrite (via -o-), the second file is skipped entirely.

Managing Case Sensitivity with Command-Line Switches

To handle or normalize case issues across platforms, unrar provides several built-in parameters:

  • -cl (Convert names to lowercase): Converts all extracted file paths to lowercase. On Linux, this can cause unintended collisions if multiple files end up with the exact same lowercase name.
  • -cu (Convert names to uppercase): Converts all extracted file paths to uppercase, behaving similarly to -cl.
  • -or (Automatically rename duplicates): On Windows, using the -or flag automatically appends an incremented number to colliding filenames (for example, creating data(1).csv). This prevents data loss when extracting archives with case-only collisions on a case-insensitive drive.

Enabling Case Sensitivity in Windows

Modern versions of Windows 10 and 11 allow per-directory case sensitivity using the Windows Subsystem for Linux (WSL) filesystem layer. If you enable case sensitivity on an NTFS folder using the fsutil file setCaseSensitiveInfo <directory> enable command, running extraction tools inside that specific directory allows Windows to handle case-differing files identically to Linux.