Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Writing Empty folders into ZipFile

Reply
Thread Tools

Re: Writing Empty folders into ZipFile

 
 
Christian Heimes
Guest
Posts: n/a
 
      06-03-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) 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.

Christian

 
Reply With Quote
 
 
 
 
MRAB
Guest
Posts: n/a
 
      06-03-2008
On Jun 3, 10:03 am, Christian Heimes <(E-Mail Removed)> wrote:
> (E-Mail Removed) 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 '/'.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: It seems that ZipFile().write() can only write files,how can empty directories be put into it? could ildg Python 0 07-02-2005 08:31 AM
Re: It seems that ZipFile().write() can only write files,how can empty directories be put into it? Jeff Epler Python 0 07-01-2005 02:06 PM
It seems that ZipFile().write() can only write files,how can empty directories be put into it? could ildg Python 0 07-01-2005 01:50 AM
Python zipfile: Zip empty directories. Mark Wondratschek Python 2 09-01-2003 11:28 AM
add empty directory using zipfile? Tung Wai Yip Python 6 06-26-2003 09:39 PM



Advertisments