1

On windows, with 7za.exe v9.38, how can I set the archive's LastWriteTime (or CreationTime) same as the content? For example : I have a "toto.txt" file, created and last written on 01/01/15.

7za.exe a -t7z toto.7z toto.txt

The "toto.7z"'s creation will be today.

With zip.exe from info-zip.org, the parameter is -o

-o make zipfile as old as latest entry

Thanks!

EDIT : You can do this with :

$srcDate = (Get-ChildItem $fileToCompress).LastWriteTime
$dstFile = Get-ChildItem $7zFile
$dstFile.LastWriteTime = $srcDate

But it would be easier with a simple command switch.

1 Answer 1

0

Try -stl switch.

7-Zip's changelog:

9.30 alpha 2012-10-26

  • LZMA2 now is default compression method for .7z format.
  • 7-Zip now can update WIM archives.
  • 7-Zip File Manager now can move files to archives.
  • The default encoding for TAR format now is UTF-8. You can use -mcp=1 switch for OEM encoding.
  • Command line version:
    • new "rn" command to rename files in archive.
    • new -sdel switch to delete files after including to archive.
    • new -sns switch to store NTFS alternate streams (for WIM format only).
    • new -sni switch to store NT security information for files (for WIM format only).
    • new -stl switch to set archive timestamp from the most recently modified file.
  • Speed optimizations for opening big archives and big disk folders.
  • 7-Zip now writes special padding blocks to headers of 7z archives for faster archive opening. Note that 7-Zip 4.50 - 4.58 contain BUG, so these old versions can't correctly work with such new 7z archives.
  • DMG support was improved
  • Some bugs were fixed.
  • The BUG in 7-Zip 9.26 alpha - 9.29 alpha versions was fixed. These alpha versions could not open non-solid 7z archive, if some files were skipped during creation of that archive. That problem is also related to 7z archives created in solid mode, if each solid block contains no more than one file. Note: 7-Zip skips files that were open for writing by another application and shows warning in that case.
  • New localization: Aragonese.
1
  • Oh, ok, it was in changelog and not in command help... thanks, it works.
    – Patator
    Sep 2, 2015 at 10:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .