467,083 Members | 1,230 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,083 developers. It's quick & easy.

ZipFile - How to update an existing zip file

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/
Jul 18 '05 #1
  • viewed: 1212
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Waitman Gobble | last post: by
5 posts views Thread by Waguy | last post: by
1 post views Thread by Ritesh Raj Sarraf | last post: by
8 posts views Thread by =?utf-8?B?5Lq66KiA6JC95pel5piv5aSp5rav77yM5pyb5p6B | last post: by
3 posts views Thread by towers | last post: by
5 posts views Thread by Neil Crighton | last post: by
1 post views Thread by John Machin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.