Hi, I have a need to zip a selection of files from a folder. Sometimes the 
number of files may be in the hundreds, and sometimes some of the files may be 
multiple gigabytes in size. I need them to be referenced from a specific base 
folder in the hierarchy. Deployment is 10.5+

From what I can see, the following are my options:

1. Use NSTask to create a zip file, passing in as arguments all the filenames 
to zip. My question about this would be whether I would run into any 
restrictions with the length of the command which well be beyond the old 1024 
character limits (not sure if any command line argument limits are still 
extant). I would think this would be the most efficient way to do it (both time 
and memory/storage wise), so long as there are no limitations on command line 
length.

2. Use NSTask to create a zip file, and then other tasks to add the files 
progressively. Concerned that this may be slow, and also the documentation says 
zip copies the files to a temporary folder and recreates the zip every time - 
probably not a good idea for a big zip and/or one with lots of files.

3. Use an NSTask to create a zip file of the entire folder, and then use other 
NSTasks to remove unwanted files. Probably won't be more than a few dozen each 
time, but I'm not sure whether it also unzips the file behind the scenes, or 
anything like that. Also it may unnecessarily be compressing a multi-GB file or 
two, which is inefficient.

4. Use the Omni zip framework to accomplish the task. As far as I can see, it 
appears to load all the files into memory in order to create the zip, so may 
not be a good idea when working with GB size files. Also the lack of 
documentation or examples makes it a little more work to understand it.

5. Copy all the files I want in my zip to a temp folder using NSFileManager, 
and then use NSTask to zip the folder. Downside, that it may take quite a while 
to copy the files, and of course you have the extra disk space used.

Are there any other options that I'm not aware of?

Which option would be the best to go with?


Advice would be most welcome.

Thx

Gideon_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to