How to Unrar Files and Keep Access Timestamps
This guide explains how to extract RAR archives while preserving
original file access timestamps using the command-line
unrar utility. By default, extracting an archive sets the
access time (atime) of extracted files to the moment of
extraction. Using the -ts switch allows you to override
this behavior and restore the exact access timestamps saved inside the
archive.
Prerequisites
For access timestamps to be restored, they must have been saved into
the RAR archive at the time of compression (typically using
rar a -tsa archive.rar files). If the archive does not
contain access time metadata, the system defaults to the current time
upon extraction.
Command Syntax
To extract files and restore their original last access timestamps,
use the x (extract with full paths) command combined with
the -tsa switch:
unrar x -tsa archive.rarTo extract to a specific destination folder:
unrar x -tsa archive.rar /path/to/destination/Preserving All Timestamps
If you need to restore all original time attributes—including
modification, creation, and last access times—use the -ts
switch without specifying a sub-parameter:
unrar x -ts archive.rarSwitch Breakdown
x: Extracts files with their original directory tree intact.-tsa: Restores the last access time stored in the archive.-tsm: Restores the modification time (enabled by default).-tsc: Restores the creation time (primarily used on Windows/NTFS).-ts: Restores all available timestamps (modification, creation, and access) with maximum precision.
Verifying File Timestamps
On Linux and macOS, verify that the access time was preserved by
inspecting the extracted file with the stat command:
stat filename.extLook for the Access: field to confirm the date and time
match the archive's original metadata.