ZIP archive folder date preservation

  • Jimbob

    Jimbob - 2011-01-14

    I've been using 7zip 9.20, command line version. I have noticed that when extracting from a ZIP archive, the folder dates are - for some folders - set to the date of extraction, not the date the folder was originally created, although viewing the archive in 7zip file manager does show that the original folder creation date is recorded. The ZIP archive was created using 7zip 9.20, command line version. Note that this is not a problem when using 7zip to create and extract a 7Z archive - original folder dates are correctly preserved upon extraction for all folders.

    An aside, according to 7-zip.chm, -mtc=on is the default for ZIP file creation, but -mtc=off is the default for 7Z. Why the difference? Also, the descriptions differ in 7-zip.chm:

    For Zip, "Stores NTFS timestamps for files: Modification time, Creation time, Last access time."
    For 7z, "Stores file creation timestamps."

    Is there actually a difference between what the two archive types store?

  • Igor Pavlov

    Igor Pavlov - 2011-01-15

    Zip format stores modified time (FAT / local time). But we need UTC NTFS timestamp. When you enable UTC NTFS timestamp, zip writes all timestamps (accesses, modified, created).
    7z format can store any of timestamps. Since only modified is most important, other are disabled.

  • Jimbob

    Jimbob - 2011-01-15


    Thanks for the swift reply and the explanation. Any idea why extracting from ZIP sometimes results in the extraction date being applied to the folder(s)?

  • Jose

    Jose - 2011-05-10


    I'm looking for help within this same subject, so I felt I didn't need to open a new discussion but just adding to this one.

    I'm using 7z to extract zip files (where I don't know who/what zipped them). I found that 7z does not preserve the right/original timestamps (for Date Created and Date Last Accessed) when unzipping some files (only the Date Modified is preserved).

    I run some tests, zipping files with windows (via compressed folders), winzip and 7z.:
    - If I use 7z or winzip to zip, it will keep the original timestamps when unzipping the files.
    - If I use compressed folders, 7z will not include the original timestamps when unzipping.
    - In every case, WinZip includes the right original timestamp in the three properties "Date Created", "Date Last Accessed" and "Date Modified".

    Is there any way to make 7z to correctly preserve the date information/timestamp when extracting ZIP files? (just like WinZip does).

    - Jose -

  • Igor Pavlov

    Igor Pavlov - 2011-05-11

    "compressed folders" application doesn't include Created and Last Accessed timestamps to archive.
    So 7-Zip can't restore them. WinZip also can't do it. Check it again.

  • Jose

    Jose - 2011-05-11

    Hi Ipavlov,

    I'm afraid my test results don't agree with you. I just performed an additional quick test to verify it:

    OS: Win 7
    7z version 9.20
    WinZip 15.5

    - I compressed two files, a MS word file and a text file via "Send to Compressed (Zip) folders" context menu.
    - I unzipped them via 7z and it did not preserve the Date Created and Date Accessed properties.
    - I unzipped them with WinZip and it did preserve all the properties in both files.

    - Jose -

  • Jose

    Jose - 2011-05-11


    I think I found out what happened… Winzip is cheating :-)
    For all my previous tests, the files had the same Date Created, Date Accessed  and Date Modified. So when I unzipped them, it was clear that Date Created and Date Accessed were not preserved since they were different than the original date and also than Date Modified. And that's where I made the wrong assumption.

    Doing more tests I realized that what Winzip  is doing (in the case of zip files by Compressed Folders) is just copying the Date Modified into Date Created and Date Accessed, as opposed as 7z that is inserting the current date/time. This only became obvious when I changed the Date Modified so it was different that Date Created and Date Accessed.

    So yes, you were right in that Compressed Folders don't store those timestamps, I got tricked by Winzip :-)

    - Jose -

  • Arcie Dy

    Arcie Dy - 2011-07-28

    My problem re date is different:  I need to know if a certain archive contains the latest file(s).  This is achieved by WinZip with the parameter -o  (lower case letter o).  This parameter changes the Zip file's file date to the same as the newest file in the Zip file.

    If for example contains two files: A1.txt dated 2011 July 1 and A2.txt dated 2011 July 4 and I zipped them on 2011 July 25 using the -o option, then will have a file date of  2011 July 4, not 2011 July 25.

    Will 7-zip soon have this capability?

  • g4j

    g4j - 2012-08-10

    I need to echo what arciedy said. I really need 7z to have an option where the date of the archive will be set the the most recent date of the file(s) it contains. 7z is a great application, but the lack of more robust date control is problematic for my automated processes.

  • Karol Moran

    Karol Moran - 2012-12-06

    ta tc
    to parameters when creating archive and file dates are preserved.


Log in to post a comment.