ZipFile and timestamps
Manfred Lotz
ml_news at posteo.de
Wed Mar 18 23:51:46 EDT 2020
On Wed, 18 Mar 2020 21:41:10 +0000
MRAB <python at mrabarnett.plus.com> wrote:
> On 2020-03-18 20:38, Manfred Lotz wrote:
> > I unzip a zip file like follows which works fine.
> >
> > with ZipFile(zip_file, 'r') as zip:
> > zip.extractall(tmp_dir)
> >
> > The only caveat is that the unpacked files and dirs do have a
> > current timestamp i.e. the timestamps of the files are not
> > preserved.
> >
> > Is there a way to tell ZipFile to preserve timestamps when
> > unpacking a zip archive?
> >
> You might have to iterate over the contents yourself and set the
> modification times.
Oops, if this is required then I better change my code to invoke unzip.
Thanks,
Manfred
More information about the Python-list
mailing list