question: How can I put empty directories into a zip-archive?
Christos TZOTZIOY Georgiou
tzot at sil-tec.gr
Thu Sep 4 10:23:24 EDT 2003
On Thu, 04 Sep 2003 15:54:57 +0200, rumours say that "T. Kaufmann"
<merman at snafu.de> might have written:
>Hi there,
>
>in my directory are some 'normal' files like *.py sources and some empty
>directories too. How can I put all togehter into a zip-archive?
>
>There is no problem to zip the *.py files but if I try to add empty directories
> an exception is trown.
This is not a direct reply to your problem, but just my 2 eurocents of
information gathered the last five minutes.
Creating a zip file with an external program, one can see that the zip
format seems to include directories, empty and non-empty (or so the
zipfile module helps us discover, when reading the externally created
zip file).
The only difference I found out so far is that the external_attr is
2172649504L (0x81800020) for files and 1103101968 (0x41c00010) for
directories. Perhaps it's a bug in the zipinfo module, but I can't
check SF at the moment.
z= zipfile.ZipFile("c:/temp/ax.zip")
for fi in z.infolist():
print fi.filename, fi.external_attr
--
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.
More information about the Python-list
mailing list