ZipFile - How to update an existing zip file

Ian Cook ian at
Thu Nov 18 00:36:43 CET 2004

I'm new to python so please excuse me if this is a 'dumb' question.

I want to use the ZipFile module to UPDATE, rather than append, or
create a new zip file.

Does anyone know how this can be done?

This is a snippet of the code I have now..

                    zf = zipfile.ZipFile(zfname,mode='a')
                    zf = zipfile.ZipFile(zfname,mode='w')
                for name in cutflist:
                    fp = os.path.join(root,name)
                    print "adding ",fp,"...",
                    compresstype = zipfile.ZIP_DEFLATED
                    if zipfile.is_zipfile(fp):
                        compresstype = zipfile.ZIP_STORED
                    print 'done.'

Thanks in advance.

Ian Cook
(Freeware author of Kirby Alarm And Task Scheduler)

More information about the Python-list mailing list