473,325 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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
Jul 18 '05 #1
2 2952
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
Jul 18 '05 #2
ThanX a lot Peter!

"Peter Otten" <__*******@web.de> wrote in message
news:bi*************@news.t-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/pyt...ne/170517.html

Peter

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tung Wai Yip | last post by:
Can I add empty directory using zipfile? When I try to add a directory it complains that it is not a file. tung
7
by: Max M | last post by:
I guess that the best approach is calling a shell tool with something like os.popen(). But I cannot seem to find any free tools. Winzip has a command line option, but for registered users only....
1
by: Fuzzyman | last post by:
I have created a set of classes that will profile a file structure and record all changes as a simple markup and single zipfile of all new/modified files. I can't get the zipfile module to archive...
0
by: could ildg | last post by:
I want to "create" a empty folder in a zipfile, Can ZipFile do it? If not, any other approachs?
3
by: rzed | last post by:
I create a zip file on my WinXP system, using this function: <fn> import zipfile import os import os.path def zipdir(dirname, zfname): zf = zipfile.ZipFile(zfname, 'w',...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 385 open (+21) / 3790 closed (+21) / 4175 total (+42) Bugs : 1029 open (+43) / 6744 closed (+43) / 7773 total (+86) RFE : 262 open...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.