Extra C_ directory in using ZipFile

Paul Moore gustav at morpheus.demon.co.uk
Mon Jan 20 16:34:27 EST 2003


makwaiming at yahoo.com (Mak) writes:

> Hi All,
>
> I am using zipFile to zip files for backup purpose. Everything seems
> to work fine except it create extra C_ directory when I try to unzip
> it using winzip 8.0. For example, if I zip up c:\abc\def and unzip
> right away. It will create directory tree like c:\C_\abc\def
>
> import zipfile
> ...
> archive= zipfile.ZipFile(filename,'w')
> archive.write(filename)
> archive.close()
>
> Anyone idea ?
>
> Note: I am using python 2.2

I'm guessing that you're trying to make the name in the zip file
something like C:\abc\def. But the zip file format doesn't support
drive letters in (internal) filenames, so ZipFile is normalising the
(otherwise invalid) colon to an underscore.

Solution: Don't try to store the drive letters in the zip filename.

Paul.
-- 
This signature intentionally left blank




More information about the Python-list mailing list