Reputation: 1008
Files extracted from a zip using the TZipFile class (I'm using ExtractAll method) get the system datetime as creation/modification file date, but I need to restore the original timestamp, like winzip/winrar do. Can the TZipFile class do it too, or I have to change the files timestamp after?
Upvotes: 2
Views: 991
Reputation: 475
Since Delphi XE6 the TZipFile class automatically keeps timestamps and attributes of extracted files (QC). So the easiest solution is to upgrade your Delphi to XE6 or newer.
If you cannot upgrade then you need to recover timestamps and attributes after extraction. The original timestamps and attributes are available in the TZipFile.FileInfos property (array of TZipHeader).
Upvotes: 1
Reputation: 613262
I'm afraid you are out of luck with the built in ZIP code. It does record the modified timestamp when creating ZIP files. But does not restore it when extracting. And there's no option to make it do so.
I think your best option is to use a third party ZIP component. For example I recommend tpAbbrevia which does support this functionality.
Upvotes: 2