Unrar Case-Sensitive Filename Conflicts on Windows
When extracting archives created on case-sensitive systems like Linux
onto Windows, filename collisions frequently occur when two files differ
only by capitalization. Because Windows uses a case-insensitive file
system by default, the unrar utility cannot place both
files in the same directory under their original names without
intervention. This article explains how unrar behaves
during these collisions on Windows and provides the exact command-line
options available to manage or prevent data loss.
The Source of the Conflict
Operating systems such as Linux treat document.txt and
DOCUMENT.txt as distinct files within the same directory.
When packed into a RAR archive on these platforms, both entries are
preserved.
Windows NTFS technically supports case sensitivity, but the Windows
subsystem and standard Win32 APIs operate in a case-insensitive manner.
When unrar attempts to extract the second file to a Windows
folder, the operating system views the target file as already existing,
triggering a naming collision.
Default unrar
Behavior on Windows
By default, when unrar encounters a case collision
during extraction on Windows, it treats the second file as an overwrite
collision.
If running in interactive mode via the command prompt,
unrar halts and prompts the user with standard overwrite
options:
- [Y]es: Overwrites the first extracted file with the contents of the second file.
- [N]o: Skips the conflicting file, keeping only the first file extracted.
- [A]ll: Overwrites all subsequent conflicting files without prompting.
- n[E]ver: Skips all subsequent conflicting files.
- [R]ename: Prompts you to manually specify a new filename for the conflicting file.
- [Q]uit: Terminates the extraction process immediately.
If the prompt is answered with overwrite, data loss occurs because the content of the first file is replaced by the content of the subsequent file.
Controlling Conflict Resolution via Command-Line Flags
To automate or handle these collisions safely in non-interactive
scripts or standard operations, unrar provides specific
switches:
- Automatic Renaming (
-or): Use this switch to preserve both files. When a collision occurs,unrarautomatically appends an incremented number to the conflicting filename (for example,DOCUMENT(1).txt).unrar x -or archive.rar - Skip Existing Files (
-o-): This switch skips any file that conflicts with an already-extracted file. The first extracted file is kept, and any case-variant duplicates are ignored.unrar x -o- archive.rar - Overwrite All (
-o+): This forcesunrarto overwrite existing files without confirmation. In a case collision, the last file extracted will replace any earlier files sharing the same case-insensitive name.unrar x -o+ archive.rar
Alternative: Enabling Case Sensitivity in Windows
Modern versions of Windows 10 and Windows 11 allow per-directory case
sensitivity on NTFS partitions. You can enable this behavior for a
target folder before running unrar using PowerShell or
Command Prompt with administrator privileges:
fsutil.exe file setCaseSensitiveInfo "C:\path\to\extraction_folder" enableOnce enabled for the destination folder, the underlying Windows
filesystem will allow both document.txt and
DOCUMENT.txt to coexist simultaneously without triggering
overwrite prompts.