How to Ignore File Attributes in Unrar
When extracting RAR archives, you may want to prevent the archive
from applying saved metadata such as read-only, hidden, or system flags
to your destination filesystem. The unrar command-line
utility provides the -ai switch specifically to ignore file
attributes entirely during extraction. This guide explains how the
-ai switch functions, how to apply it in common extraction
commands, and how to combine it with related options to handle archive
metadata cleanly.
The -ai Switch
The switch used by unrar to ignore file attributes
is:
-aiBy default, unrar restores original file attributes
stored in the archive, including:
- Read-Only
- Hidden
- System
- Archive
Using the -ai switch forces unrar to
discard these attributes upon extraction, creating the extracted files
with default OS permissions rather than their archived states. This is
especially useful when extracting read-only files that you plan to
immediately edit or delete, or when preventing hidden files from
remaining invisible on your target system.
Basic Usage Examples
To extract an archive into the current directory with full directory paths while ignoring all file attributes, run:
unrar x -ai archive.rarTo extract all files directly into the current folder without preserving their internal folder structure:
unrar e -ai archive.rarRelated Metadata Switches
While -ai handles general file attributes, you may want
to exclude other metadata types depending on your use case:
- Ignore File Timestamps (
-ts-): Preventsunrarfrom setting modification, creation, or last-access times from the archive.unrar x -ai -ts- archive.rar - Ignore File Owner/Group Security (
-ow-on Unix/Linux): Skips the extraction of original owner and group security information.unrar x -ai -ow- archive.rar