Note that there are some explanatory texts on larger screens.

plurals
  1. POBest way to loop through a lot of files and zip each one separately?
    text
    copied!<p>I need to loop through a relatively large set of files (> 5000), zipping and uploading each one <em>separately</em> (not as directories or groups of files) to a server in turn.</p> <p>The biggest part of my problem is to know which is the best way to do the zipping in terms of ease of implementation and performance. I thought there must be a standard Cocoa framework for something that is apparently a very common requirement but there doesn't seem to be any such framework. Other suggestions and approaches I've found so far:</p> <ul> <li><a href="http://code.google.com/p/zip-framework/" rel="nofollow">zip.framework</a> at code.google.com, which "is a cocoa framework for easy zip file listing, reading and writing. The main purpose of this framework is to prevent you from having to use command line utilities in your application by providing a native Cocoa interface" - seems a lot of people have found this link (but I didn't notice anyone who had actually used it before!)</li> <li><a href="http://code.google.com/p/ziparchive/" rel="nofollow">ziparchive</a> also at code.google.com - "base on open source code 'MiniZip'".</li> <li>Suggestions about using <code>NSTask</code> to call command line utilities such as <strong>ditto</strong> are common, such as in this <a href="http://www.cocoadev.com/index.pl?UsingZipFilesExamples" rel="nofollow">CocoaDev question</a> but I don't like the idea of having to do it</li> <li>Similarly, someone here suggested <code>NSTask</code> to call <strong>zip</strong> and <strong>unzip</strong> - but this <a href="http://www.cocoadev.com/index.pl?ZipArchiveLibraryForCocoa" rel="nofollow">posting</a> says that the "only problem is that when the files are decompressed, the Mac headers have been stripped, so Mac OS dosen't recognize the file!! (i.e. I zip an application and it stripps the "appl" from the file. When I unzip it, it is unusable."</li> <li>Someone's framework called <strong>ZipKit</strong> <a href="https://bitbucket.org/kolpanic/zipkit/wiki/Home" rel="nofollow">here</a></li> <li><a href="http://www.cocoadev.com/index.pl?ZipArchiveLibraryForCocoa" rel="nofollow">Another CocoaDev question</a> discusses several approaches e.g. creating wrapper for C++ archiving code, creating C wrapper for <strong>zlib</strong> and <strong>minizip</strong> (minizip is built around zlib), etc</li> <li>Something about <a href="http://www.cocoadev.com/index.pl?NSDataCategory" rel="nofollow">NSDataCategory</a> (didn't understand it)</li> <li>An open-source manga/comic book reader(!) from www.feedface.com called <a href="http://www.feedface.com/projects/ffview.html" rel="nofollow"><strong>FFView</strong></a> which has its own separate <a href="http://www.feedface.com/projects/files/ffview/FFArchive-src-0.6.tar.bz2" rel="nofollow">archiving framework</a></li> </ul> <p>The zipped files need to be unzipped in Windows.</p> <p>Please, I hope someone has real-world experience with a solution that meets similar requirements to mine. As you can see, I've already found a lot of links so just another link to another framework/approach without something that actually indicates its applicability to my problem will not really be very helpful.</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload