Switch -TS[m,c,a,p][+,-,1] - save or restore file time (modification, creation, access, preserve)
Use -tsm to save the file modification time, -tsc for creation time and -tsa for last access time. Multiple -ts switches, such as -tsc -tsa, are allowed. If 'm', 'c' or 'a' are not specified, all three file times are assumed.
Append '+' to store a file time with maximum possible precision. Concrete value depends on a operating system and file system and can be up 100 nanoseconds in Windows and 1 nanosecond in Unix. Append '1' to set 1 second precision or '-' to not save a file time. If '+', '-' or '1' are not present, '+' is assumed, so -ts+ and -ts both save all three high precision times.
All stored times for same file always have the same precision. If different precisions are specified, such as -tsm1 -tsc+, common one is selected.
RAR 4.x archives always contain the modification time and for RAR 4.x archive -tsm- still saves the modification time with the lowest possible 2 second precision. Two other times can be disabled. RAR RAR 5.0 archives allow to omit any file time including modification, so unpacked files will have the current system time. Switches -tsm- -tsc- -tsa- or just -ts- will store a low precision modification time for RAR 4.x and no file time for RAR 5.x archive.
If -ts switch is not specified, RAR stores the high precision modification time and omits two other times.
By default WinRAR sets only the modification time for extracted files, even if archive contains other times. Use -ts or -ts+ when unpacking to set all three times, -tsc and -tsa to set creation and last access times, -tsm- or -ts- to set the current system time instead of modification time stored in archive.
Use -tsp switch to preserve the original last access file time of source files when archiving. This switch attempts to keep the original last access time of archiving files, but it does not control which timestamps are to be stored in archive. It has to be combined with other -ts switches for this purpose. For example, if we wish to save the last access time to archive and preserve the last access time of source files, we need to use -tsa -tsp together. This switch can prevent to open some files, which can be opened without it.
It is allowed to combine several modifiers in the same switch, such as -tscap instead of -tsc -tsa -tsp.
All modes described above are supported only by RAR format. In ZIP archives the high precision modification time is stored in the same data structure as creation and last access times. When archiving to ZIP, all three times are controlled by -ts or -tsm option, while -tsa and -tsc are ignored. Use -ts or -tsm to save all times in high precision format (default ZIP mode), specify -ts- or -tsm- to store only the low precision modification time. When unpacking ZIP archive, -tsm -tsc -tsa switches can be used individually to control corresponding times just like as for RAR format.
Examples
- Store all file times with the highest possible precision:
WinRAR a -ts backup
- Restore modification and last access time. Switch -tsm is not required, because RAR sets the modification time by default. If we wish to restore only the last access time, we should use -tsm- -tsa switches:
WinRAR x -tsa backup
- Store low precision modification and creation time. Preserve the last access time of source files.
WinRAR a -tsm1 -tsc1 -tsp backup