Hi,
What about this:
import os,zipfile
from os.path import join
zip = zipfile.ZipFile("myzipfile.zip", 'w')
for root, dirs, files in os.walk('.'):
for fileName in files:
zip.write(join(root,fileName))
zip.close()
Maybe it zips also the myzipfile.zip ;-)
Probably this is not needed, so an additional test (something like
fileName != 'myfile.zip' would be needed.
HTH,
Peter
could ildg wrote:
> I want to compress a folder and all of its sub files including empty folders
> into a zip file. what's the pythonic way to do this?
>
> Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list