1. Oct '10

    Zipping up Directories with Symlinks in Python

    I wrote this function for a larger project to zip up applications for Sparkle. At some point I’ll get around to open sourcing the entire module but for now I figured I’d share the code for zipping up a directory. The reason I want to share it is it turned out to be harder to zip up a directory, especially one with symlinks.

    This function can create an identical copy of the data in a zip file, symlinks and all. It took several hours to perfect and several other functions for reference :) It should work fine on windows, but I haven’t tested it.

    Edit: It was pointed out on reddit that empty directories weren’t making it into the zip. This has been fixed.

    Edit: I’ve tried this function on windows and it works, I had to fix one issue with empty directories.