[issue4710] [PATCH] zipfile.ZipFile does not extract directories properly

Kuba Wieczorek report at bugs.python.org
Sun Dec 21 14:10:11 CET 2008


New submission from Kuba Wieczorek <faw217 at gmail.com>:

This behaviour has been known of course for quite long time. I suppose
this is not intentional so I've played a bit with this and I hope you'll
consider some little change.

Currently, if a ZIP archive contains some subdirectories then
zipfile.ZipFile.extract()/extractall() will create files instead of
directories in the target location. This of course will lead some
scripts to crash (unless any work-around has been done) because files
from the subdirectories couldn't be created.

Attached is a patch against current 2.7 tree. Applied, will make
extractall() extract properly all the contents of the archive with
proper tree structure. If a directory name is passed to the extract(),
it will only create the directory itself without the contents (I guess
it is obvious).

----------
components: Library (Lib)
files: zipfile_extract_dirs.patch
keywords: patch
messages: 78143
nosy: faw
severity: normal
status: open
title: [PATCH] zipfile.ZipFile does not extract directories properly
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file12413/zipfile_extract_dirs.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4710>
_______________________________________


More information about the Python-bugs-list mailing list