Date & time in a Zip File

  • Thread starter Tim Williams (gmail)
  • Start date
T

Tim Williams (gmail)

Using zipfile.Zipfile

How can I add a file to a zip file and keep its date and time correct?
Currently the date/time change to the time the file was added to the
zip. Zipinfo doesn't have a write method!

Solutions other than zipfile are welcome, with snippets if possible :)

ginmf in this instance.
 
L

Larry Bates

When I add files to my .ZIP files using python zipfile module
the date/time that is stored in mine is the one that comes from
the file's attributes. I'm not sure I understand why you think
yours are not.

-Larry Bates
 
S

Scott David Daniels

Tim said:
Using zipfile.Zipfile

How can I add a file to a zip file and keep its date and time correct?
Currently the date/time change to the time the file was added to the
zip. Zipinfo doesn't have a write method!

Solutions other than zipfile are welcome, with snippets if possible :)

I am working some new code for zipfile. If you are interested in a
partial step towards what you want, at the cost of having to read
and/or use a bunch of half-done code, grab a copy of:

http://members.dsl-only.net/~daniels/zipf.py

You should then be able to do something like:

import zipf
z = zipf.ZipFile('whatever.zip', 'a')

and then copy the code for .write(...)
using your own zinfo block. I imagine I'll eventually have a method
like that named ".write_info(zinfo, data_iterator)" or something.

--Scott David Daniels
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top