Re.'Compressing folders in Windows using Python'

Tim N. van der Leeuw tim.leeuwvander at nl.unisys.com
Mon Jan 2 09:20:58 EST 2006


Isn't it much easier to figure out how python built-in module 'zipfile'
works?

Pseudo-code would be something like:

#UNTESTED
import zipfile
import os
import os.path

zf = zipfile.ZipFile('myzipfilename.zip', 'w', zipfile.ZIP_DEFLATED)
for root, dirs, files in os.walk('compressthisdir'):
    for f in riles:
        fullname = os.join(root, f)
        zf.write(fullname)
zf.close()


Cheers,

--Tim




More information about the Python-list mailing list