Unrar Switch to Rename Files to Lowercase
When extracting files from a RAR archive, maintaining uniform file
naming conventions across operating systems can prevent path errors and
script failures. This article explains which command-line switch forces
the unrar utility to automatically convert all extracted
file and directory names to lowercase, along with standard command
examples for direct implementation.
The Lowercase Switch: -cl
The switch that forces unrar to convert all extracted
file and folder names to lowercase is
-cl.
When included in your command, -cl intercepts the
original names stored inside the archive header and writes them to the
disk entirely in lower case, regardless of how they were capitalized
when the archive was created.
Syntax and Usage
The -cl switch works with both full-path extraction
(x) and flat extraction (e).
1. Extract with Full Directory Paths
To extract all contents, preserve the directory hierarchy, and convert every file and folder name to lowercase:
unrar x -cl archive.rar /path/to/destination/2. Extract Without Directory Paths (Flat)
To unpack all files directly into the target folder without creating subdirectories, while making all filenames lowercase:
unrar e -cl archive.rar /path/to/destination/Important Considerations
- Case Sensitivity on Linux/macOS: Unlike Windows,
Linux and macOS (on case-sensitive filesystems) treat
FILE.TXTandfile.txtas distinct files. If an archive contains two files in the same directory that differ only by case (e.g.,Test.txtandtest.txt), applying-clwill cause a naming collision, promptingunrarto overwrite or skip the second file. - Opposite Switch (
-cu): If you ever need the inverse behavior, the-cuswitch forces all extracted filenames to uppercase.