Skip navigation.
 
mlRe: ZIP archives
FROM : Nir Soffer
DATE : Tue Jul 25 22:51:39 2006

On 25/07/2006, at 22:24, Mike Abdullah wrote:

> I am wanting to implement in my app the ability to create 
> standard .zip archives.  I have looked through the list archives 
> and read various things on the internet, but I'm rather confused :(


I'm in the same situation. According to my research, these are the 
options:

1. Using Python zipfile - the easiest way but does not support 
resource forks:

    # zip the contents of folderPath in archivePath

    import os
    import zipfile

    prefixLength = len(archivePath)

    zip = zipfile.ZipFile(archivePath, 'w', zipfile.ZIP_DEFLATED)

    for root, dirs, files in os.walk(folderPath):
        for file in files:
            # You may exclude files here, change file archive name etc.
            fileName = os.path.join(root, file)
            archiveName = fileName[prefixLength:]
            zip.write(fileName, archiveName)

    zip.close()
   

2. Using ditto (is it available on every mac?):

   ditto -ckX "/path/to/folder" "/path/to/ArchiveName.zip"


3. Using minizip library, part of zlib distribution - did not check yet.

zip command line tool is annoying, I would not use it.


Best Regards,

Nir Soffer

Related mailsAuthorDate
mlZIP archives Mike Abdullah Jul 25, 21:24
mlRe: ZIP archives Alan Smith Jul 25, 21:35
mlRe: ZIP archives Scott Thompson Jul 25, 21:38
mlRe: ZIP archives I. Savant Jul 25, 21:39
mlRe: ZIP archives Nick Zitzmann Jul 25, 22:08
mlRe: ZIP archives I. Savant Jul 25, 22:19
mlRe: ZIP archives Joshua Scott Emmon… Jul 25, 22:31
mlRe: ZIP archives Nir Soffer Jul 25, 22:51
mlRe: ZIP archives Matt Mashyna Jul 26, 00:24
mlRe: ZIP archives Michael Hall Jul 26, 00:44
mlRe: ZIP archives Ryan Britton Jul 26, 01:02
mlRe: ZIP archives Dragan Mili? Jul 26, 08:29
mlRe: ZIP archives Mike Abdullah Jul 26, 13:44