Python zipfile: Zip empty directories.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark Wondratschek

    Python zipfile: Zip empty directories.

    Hi!
    I hope it's a simple question:
    How can I pack empty directories? I want to mirror a whole directory
    structure in an archive. So I want to zip non-empty AND empty directories.
    Any ideas?
    Thank you in advance!

    Best regards

    Mark


  • Peter Otten

    #2
    Re: Python zipfile: Zip empty directories.

    Mark Wondratschek wrote:
    [color=blue]
    > How can I pack empty directories? I want to mirror a whole directory
    > structure in an archive. So I want to zip non-empty AND empty directories.
    > Any ideas?[/color]

    As far as I remember, the zip format does not support storing empty
    directories. But you could put a file with an easily recognizable name in
    all empty directories, e.g. __empty__.

    Peter

    Comment

    • Mark Wondratschek

      #3
      Re: Python zipfile: Zip empty directories.

      ThanX a lot Peter!

      "Peter Otten" <__peter__@web. de> wrote in message
      news:biqg9h$9g8 $01$1@news.t-online.com...[color=blue]
      > Mark Wondratschek wrote:
      >[color=green]
      > > but this must be supported by the zip format
      > > ('cause winzip etc. does it this way). The empty-file idea was one of my
      > > reflections, too. But I'm sure there must be better ways...[/color]
      >
      > See what I've found (did not test it myself) googling for
      > zip empty directory:
      >
      > http://mail.python.org/pipermail/pyt...ne/170517.html
      >
      > Peter[/color]


      Comment

      Working...