473,288 Members | 1,794 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,288 software developers and data experts.

Re: Writing Empty folders into ZipFile

ot*****@o2.pl 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

Jun 27 '08 #1
1 2325
On Jun 3, 10:03 am, Christian Heimes <li...@cheimes.dewrote:
otae...@o2.pl 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 '/'.
Jun 27 '08 #2

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
2
by: T. Kaufmann | last post by:
Hi there, in my directory are some 'normal' files like *.py sources and some empty directories too. How can I put all togehter into a zip-archive? There is no problem to zip the *.py files but...
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?
13
by: could ildg | last post by:
I want to check if a folder named "foldername" is empty. I use os.listdir(foldername)== to do this, but it will be very slow if the folder has a lot of sub-files. Is there any efficient ways to do...
4
by: sri2097 | last post by:
Hi all,This is in reply to the 'Compressing folders in Windows using Python' query I raised y'day. I figured out that windows does not allow command line zipping so I started looking for...
2
by: durumdara | last post by:
Hi! I want to check my zip file writings. I need some callback procedure to show a progress bar. Can I do that? I don't want to modify the PyLib module to extend it, because if I get another...
5
by: RyanL | last post by:
I'm a newbie with a large number of data files in multiple directories. I want to uncompress, read, and copy the contents of each file into one master data file. The code below seems to be doing...
5
by: Per Juul Larsen | last post by:
Hi. My application creates empty libraries. How do I ensure that the user copies at least one or more picture files (.jpg) in each of the empty folders ? Result , no empty folders! regards pjl
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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)...

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.