Python zipfile: Zip empty directories.

Discussion in 'Python' started by Mark Wondratschek, Aug 29, 2003.

  1. 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
     
    Mark Wondratschek, Aug 29, 2003
    #1
    1. Advertising

  2. Mark Wondratschek

    Peter Otten Guest

    Mark Wondratschek wrote:

    > 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?


    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
     
    Peter Otten, Aug 29, 2003
    #2
    1. Advertising

  3. ThanX a lot Peter!

    "Peter Otten" <> wrote in message
    news:biqg9h$9g8$01$-online.com...
    > Mark Wondratschek wrote:
    >
    > > 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...

    >
    > See what I've found (did not test it myself) googling for
    > zip empty directory:
    >
    > http://mail.python.org/pipermail/python-list/2003-June/170517.html
    >
    > Peter
     
    Mark Wondratschek, Sep 1, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fuzzyman

    Empty directories with zipfile

    Fuzzyman, Jun 9, 2004, in forum: Python
    Replies:
    4
    Views:
    1,662
    Fuzzyman
    Jun 11, 2004
  2. could ildg
    Replies:
    0
    Views:
    468
    could ildg
    Jul 1, 2005
  3. Jeff Epler
    Replies:
    0
    Views:
    399
    Jeff Epler
    Jul 1, 2005
  4. Márcio Faustino
    Replies:
    3
    Views:
    345
    Márcio Faustino
    Apr 12, 2009
  5. Graham Wood
    Replies:
    3
    Views:
    547
    A. Sinan Unur
    Jan 11, 2004
Loading...

Share This Page