Script to make Windows XP-readable ZIP file

softwindow softwindow at gmail.com
Fri May 19 07:05:19 CEST 2006


import os
import zipfile
z =
zipfile.ZipFile(r"c:\text.zip",mode="w",compression=zipfile.ZIP_DEFLATED)
cwd = os.getcwd()
try:
    for dirpath,dirs,files in os.walk(cwd):
        for file in files:
            z_path = os.path.join(dirpath,file)
            start = cwd.rfind(os.sep)+1
            z.write(z_path,z_path[start:])
    z.close()
finally:
    if z:
        z.close()


*********************
can work




More information about the Python-list mailing list