How do I programmatically check the date of a file in a Zip archive?
Someone asked on Stack Overflow:
Given that I have a zip file called
archive.zipthat contains a file calledcustomerData, how can I programmatically check the date of the file insidearchive.zip? I’m using the command-line Winzip utility wzunzip, but I wouldn’t object to possibly using something else.I’m writing a .net application that will periodically read data from
customerData. The file is very big and I want to abort the operation without extractingcustomerDataif the date stamp has not been updated, indicating that there is new data to read.
I posted the following answer, which was chosen as the accepted answer and received 1 upvote:
Via http://dotnetzip.codeplex.com/. There is no native way (that I know) to do that.
Example Code:
ZipFile z = ZipFile.Read(@"C:\archive.zip");
foreach (ZipEntry zEntry in z)
{
Console.WriteLine(zEntry.LastModified.ToString());
}
Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.