We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Zip (.NET) - Preserve time stamps on archived files

How do you create a Zip archive that preserves the time stamps of the files being zipped?
I have tried:
archive.CreateEntries(di, includeRootDirectory)
to zip an entire folder and also tried adding the entries individually using:
archive.CreateEntry(entryName, fi)
but in both cases the zipped files have their time stamps updated to be the time at which they were zipped.
This is not what is wanted and defeats the primary purpose of zipping the files (which is to preserve the metadata as the files are copied from one system to another). It is also not the functionality that a standard, manual zip in Windows would deliver.

Hello @jburnett
I’ve checked - Aspose.Zip keeps creation and last modified times. Last accessed time is set to the time it was zipped - sounds logical to me. 7-zip tool proceeds the similar way. Do you want the last accessed time to be kept?

I need the Zip archive to reflect the time stamps of the files before they were zipped. The purpose of zipping them is to transfer them between file system without changing them. Although setting the time last modified to the time they were zipped does make sense, it is not what is needed. If you copy a file in Windows, you expect to get a copy, not a new file with the same content and an updated tie stamp.
I have switched over to using System.IO.Compression where ZipFile.CreateFromDirectory does it exactly what I need.
Thank you for confirming the behaviour of Aspose.Zip.

Ok, now it is clear. Let us think over your necessity and may be we’ll introduces a settings for that time stamp or something else. I’ll inform you if we decide to go this way.