How to Unrar Files with the Current Date

By default, the unrar utility restores the original timestamps stored inside an archive whenever files are extracted. If you want every extracted file to reflect the current system date and time instead of its historical archive date, you can instruct unrar to disable timestamp restoration using the -ts switch. This guide explains how to apply this option directly from the command line.

The Command Switch: -ts-

To force unrar to use the current date and time, append the -ts- switch to your extraction command.

unrar x -ts- archive.rar

If you want to extract without preserving the internal folder structure, replace x with e:

unrar e -ts- archive.rar

How It Works

The -ts switch controls file timestamps, including modification, creation, and last access times:

  • Default Behavior: unrar reads the metadata stored in the RAR archive and updates the extracted files on your disk to match the original dates.
  • -ts- (Disable All Timestamps): By adding a minus sign (-) after -ts, you disable the restoration of all archived timestamps. Because the operating system assigns the current system date and time whenever a new file is written to the disk, the extracted files will retain that current timestamp.

Modifying Only Specific Timestamps

If you want to target specific time attributes rather than disabling all of them, specify the exact attribute letter before the minus sign:

  • Modification Time Only: Use -tsm- to give files the current modification date while preserving other attributes if supported.
  • Creation Time Only: Use -tsc- to ignore the stored creation date.
  • Access Time Only: Use -tsa- to ignore the stored access date.

For general purposes, using -ts- is the most reliable way to guarantee that every extracted file receives the exact date and time the extraction took place.