I’ve been trying to use the zipfile and shutil.make_archive modules to recursively create a zip file of a directory. Both modules work great–except empty directories do not get added to the archive. Empty directories containing other empty directories are also silently skipped.
I can use 7Zip to create an archive of the same path and empty directories are preserved. Therefore I know this is possible within the file format itself. I just don’t know how to do it within Python. Any ideas? Thanks!
There is a example using zipfile: