SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

file date time in zip ?

Last post 08-23-2008 5:40 AM by JohnReilly. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-21-2008 12:40 PM

    • kking
    • Not Ranked
    • Joined on 08-21-2008
    • Posts 3

    file date time in zip ?

    Can I store the file (maybe folders) the original file date and time as shown in explorer ?

    Everything currently ends up with date time as when it was zipped.

     

  • 08-21-2008 9:19 PM In reply to

    Re: file date time in zip ?

    Hi,

    The date time that ends up in the zip archive is present in each ZipEntry that is added to the archive.  There are multiple ways of getting this value set how you wish depending on what classes you are using.

    The simplest is to set the DateTime property directly. There is also a ZipEntryFactory class that can be used to generate these for you.

    Note that zip extra data can change the date when reading.  This isnt a problem when you are creating your own archives as you control this and by default this doesnt happen but may confuse things when looking at archives created by others.

     

    hth, -jr-

     

  • 08-22-2008 10:39 PM In reply to

    • kking
    • Not Ranked
    • Joined on 08-21-2008
    • Posts 3

    Re: file date time in zip ?

    thanks

    I've now set ZipEntr.DateTime = File.GetLastWriteTime(path) 

    only issue is if I compare to files in explorer or a zip created from explorer some but not all are 1 hour different ?

     

     

  • 08-23-2008 5:40 AM In reply to

    Re: file date time in zip ?

    Hi,

    You can get 1 hour issues with files due to daylight saving time.  The library internally doesnt do an UTC or other conversions so should give back what you pass in bar the potential loss of precision in seconds which are only accurate to within two seconds.

     

    Cheers, -jr-

Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.