Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

Make Separate Zip Files of specified size limit

User has multiple pdfs and wasnt to make separate zip archives that don't go over 10 MBs in size. But they don't want to keep making them and guessing how many pdfs to put in them.

Is there a way to use winzip to select the files and set a limit and have it make separate self-contained zip files of the specified size limit?

I found the span and split settings but it seems to make a main zip file and then accompanying files that work with that zip file.

Can they be completely separate?
0
mrmyth
Asked:
mrmyth
1 Solution
 
Dr. KlahnPrincipal Software EngineerCommented:
ZIP is a run-length compression method, so there's no way to tell how big the resulting file will be until the compression process is finished.  Then you look at the resulting ZIP file and say, aha, 10.4 MB.

What you want is something like the WinRAR extended archive feature, where you specify the files you want archived and WinRAR creates multiple segmented archive files under the specified limit.  (see below)  Unfortunately, WinRAR can do this only for RAR files, and it generates one segmented archive as a set of individual files, not multiple archives that fit in the size limit.

new-1.gif
If the customer is not particular about pushing the ZIP file size right up to the 10 MB limit, there is an heuristic you could try, with the knowledge that (a) it's not automatic and (b) occasionally it will fail and the resulting file will be oversize.

Take a wide sampling of the PDF files.  Compress each one individually.  Check the compression factor.  This is the worst case; compression of only one file.  Average the compression factor across all files.

Set a reasonable upper limit for ZIP file size, say 9 MB, which allows slop-over in case of bad compression.

Choose a PDF file, check the size, multiply by the compression factor.  See if this will overrun the 9 MB limit.  If not, add it to the proposed ZIP file.  Iterate until the limit overruns, then back off one file.

Create the ZIP file from the selected files.  Remove the PDF files from the available pool of PDF files.

Iterate until all PDF files have gone into a ZIP archive.

This sounds bad but is pretty quick in a Perl script.
0
 
mrmythAuthor Commented:
Thanks.
0
 
gheistCommented:
7zip can create volumes (i.e keep files, sort them, and attempt to fit smaller files into X sized archive, unless file is too big)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now