Hi, Ive written this easy and fast function cause there it was impossible for me to find one that zip a directory without external libraries:
import zipfile import sys import os def zipdir(zipPath,directory="./"): """Store the cdontent of directory to a zipPath file, if directory is not given stores the content of the current dir ( [EMAIL PROTECTED] )""" directory=os.path.realpath(directory) zipObject = zipfile.ZipFile(zipPath, 'w') for root, dirs, files in os.walk(directory): for file in files: arcfile=root[len(os.path.commonprefix((directory, root))) +1:]+"/"+file #retrieves the inner relative file path filepath=os.path.join(root,file) zipObject.write(filepath,arcfile) zipObject.close() return zipObject #for optional further elaborations -- http://mail.python.org/mailman/listinfo/python-list