topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday December 1, 2024, 3:18 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: SOLVED: Zip set archive time to latest file  (Read 9987 times)

blauand

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
SOLVED: Zip set archive time to latest file
« on: October 11, 2018, 06:27 PM »
Hello,

The goal is to change time/date to the latest file inside a zip archive.
As a reference. winrar has a command to do this tho it just works for rars
> rar.exe ch -tl

I've searched the web but did not find anything similar for zips.
I'll greatly appreciate if someone would like to help me with this petition.
Thanks for reading!

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Zip set archive time to latest file
« Reply #1 on: October 11, 2018, 07:01 PM »
i found during a quick search this.
no worry, it is written in english for sevenzip application.

is that okay for you?

if link goes down, heres carbon copy
-stl (Set archive timestamp from the most recently modified file) switch
Syntax
-stl
If -stl switch is specified, 7-Zip sets timestamp for archive file as timestamp from the most recently modified file in that archive.

Examples
7z u a.7z -stl *.txt
Commands that can be used with this switch
a (Add), d (Delete), rn (Rename), u (Update)

blauand

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: Zip set archive time to latest file
« Reply #2 on: October 12, 2018, 04:32 AM »
Yes! thank you Kode,

I must have some sight/comprehension issues, yesterday I was looking exactly for this with negative results.
Thanks again for the time it took to help me.  :)

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Zip set archive time to latest file
« Reply #3 on: October 12, 2018, 05:01 AM »
i just searched for "7zip commandline", landed in japan and clicked my way into.
you are welcome  :Thmbsup:

blauand

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: Zip set archive time to latest file
« Reply #4 on: October 12, 2018, 06:51 AM »
Hello again,

I've been experimenting with this 7zip command and while Kode's answer has fullfiled my initial question I'd like to add a bit of complexity to it.
As far as I tested it seems the proposed 7zip command/syntax does alter the archive checksum when changing the timestamp (winrar maintains the original checksum for rar archives).
So anyone knows an alternative syntax or tool (preferably a command line one to be used within another script) to achieve the desired results?

Thanks for reading!

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Zip set archive time to latest file
« Reply #5 on: October 12, 2018, 08:14 AM »
please provide more information like how do you calculate checksum?
on a quick self test and using 7z as checksum checker, all is fine/same value = archive itself got same CRC.
when using external tools to calculate a CRC there might be troubles because they read whole file as something to calculate, and a different timestamp will always result in a different CRC since the stamp itself is part of file.

blauand

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: Zip set archive time to latest file
« Reply #6 on: October 12, 2018, 12:23 PM »
I re-tested again with same results tho since you commented that no checksum was modified in your side. I just uninstalled/installed 7zip again and rebooted the desktop.
After that new tests are in line with yours, no hashes modified, so far so good.
Thanks for keep responding to me Kode.
For the record, MD5 and SHA-1 were calculated from within Directory Opus.

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: Zip set archive time to latest file
« Reply #7 on: October 12, 2018, 12:36 PM »
great to hear that you succeeded!


best wishes,

KodeZwerg

blauand

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: SOLVED: Zip set archive time to latest file
« Reply #8 on: October 15, 2018, 06:17 AM »
To complete the information for future readers...

rar. exe only supports RAR format.
I was pointed to use winrar.exe in command line mode.

Thanks