.netzipwinzip

How do I programmatically check the date of a file in a Zip archive?


Given that I have a zip file called archive.zip that contains a file called customerData, how can I programmatically check the date of the file inside archive.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 extracting customerData if the date stamp has not been updated, indicating that there is new data to read.


Solution

  • 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());
    }