create zip archive

99miles mac at magusdesigns.com
Wed Mar 6 18:19:32 EST 2002


hi-
 i am creating a zip file from a directory. it is working great, but
the files in the subdirectories get put into the top level directory
in the zip file. I want the directory structure to remain intact when
i extract the zip file.
 How can I do this? Any ideas? thanks a lot-
 Mac

I am using this code, currently:

for name in glob.glob("mypath/*"):
     if os.path.isfile(name):
          file.write(name, os.path.basename(name),
zipfile.ZIP_DEFLATED)



More information about the Python-list mailing list