ZipFile - How to update an existing zip file

I

Ian Cook

Hi,
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..

try:
zf = zipfile.ZipFile(zfname,mode='a')
except:
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
zf.write(fp,compress_type=compresstype)
print 'done.'



Thanks in advance.

Ian Cook
(Freeware author of Kirby Alarm And Task Scheduler)
http://www.kirbyfooty.com/
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top