Writing Empty folders into ZipFile

MRAB google at mrabarnett.plus.com
Tue Jun 3 16:25:05 CEST 2008


On Jun 3, 10:03 am, Christian Heimes <li... at cheimes.de> wrote:
> otae... at o2.pl schrieb:
>
> > Hello.
>
> > I'm having situation writing folders structure into
> > a zip file. Folders contain no files.
>
> > Is it possible to do in python ?
>
> As far as I remember the zip format it's not possible at all. Folders
> are created implicitly. The zip format doesn't support empty directories.
>
Zip files don't actually support folders; it's just that by convention
slashes ('/') are used in the names to represent the folder hierarchy,
eg. "a/b" is taken to mean file "b" in subfolder "a". I've found from
experience that you can represent an empty folder with an empty file
whose name ends with '/'.



More information about the Python-list mailing list