Can Unrar Extract Files Newer Than a Specific Date?
Yes, the unrar command-line utility can extract only
files that have been modified since a specific date. By using the
built-in -tn (time newer) switch, you can filter the
contents of an archive and extract only the items meeting your exact
timestamp criteria. This guide explains how to format date strings,
apply the switch to standard extraction commands, and use relative time
limits.
The -tn Switch Syntax
The -tn switch tells unrar to process only
files newer than a specified date and time. The general syntax for the
command is:
unrar x -tn<date/time> archive.rarNote that there should not be a space between -tn and
the timestamp value.
Formatting the Date
The date string follows the YYYYMMDDHHMMSS format. You
do not need to provide the entire sequence down to the second; you can
provide only the year, month, and day.
- Full date and time: To extract files modified after
October 15, 2023, at 14:30:00:
unrar x -tn20231015143000 archive.rar - Date only: To extract files modified after January
1, 2024:
unrar x -tn20240101 archive.rar
Using Relative Time
In addition to absolute dates, unrar accepts relative
time increments using days (d), hours (h),
minutes (m), or seconds (s).
- To extract files modified within the last 7 days:
unrar x -tn7d archive.rar - To extract files modified within the last 12 hours:
unrar x -tn12h archive.rar
Complementary Switch:
-to
If you ever need the reverse functionality—extracting only files
modified before a specific date—replace -tn with
-to (time older).
- Extract files modified before June 1, 2022:
unrar x -to20220601 archive.rar