Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking for way to zip a big folder into many 20Mb files. I don't want the zip file split into smaller ones. Instead I want to group some sub files/folders into groups which is 20Mb when zipped.

If you know how to do so, please help!

Update

I need to use the smaller zipped files alone which are able to be unzipped alone.

My intention is to use virustotal.com to scan a big folder.

share|improve this question
    
Any details about operating system you're using? –  Pitto Apr 1 '11 at 13:40
    
@Pitto I use Windows-7 –  Nam G VU Apr 4 '11 at 8:48

5 Answers 5

In winzip: Add the files to the zip either by starting up winzip and adding or drag and drop into winzip or right click on the files and winzip 'add to zip...'

Then in winzip:

Actions - Split at the bottom of 'part size' pick 'other size' then put 20 and select mb

Done!

share|improve this answer
2  
Staying on the free side also 7zip works perfectly :) –  Pitto Apr 1 '11 at 13:40
    
This will split the zip file, and we cannot use the splitted parts alone. –  Nam G VU Apr 4 '11 at 5:31
    
Omg now I understand better what you're looking for... I just can't find any kind of solution to you problem, then :( What about using the free and marvellous Malwarebytes Antimalware to scan the files locally? –  Pitto Apr 4 '11 at 9:09

Not an easy prospect I'm afraid.

I recently wrote a script to gather files into subdirectories not larger than 4.3GB for easy storage on DVD, but this was all uncompressed.

Doing it with compression - now there's the challenge. You can't predict the size of the files after compression - all you could do is keep adding files to the zip in descending order of size until it exceeds 20MB and then remove the last file replacing it with a smaller one until it drops below 20MB. If you exhaust all the files and it's still >20MB then just drop the last file and move on to the next zip.

Quite a tricky bit of scripting and a rather slow, painful, process.

share|improve this answer
    
Here my thought. Why not simply group files/folders into <=20Mb unzipped group then zip them? We do not need the .zip result files to be exactly 20Mb each. –  Nam G VU Apr 4 '11 at 9:05
    
Possible - not sure how you'd go about that in windows with scripting - I used Perl on Linux before. –  Majenko Apr 4 '11 at 9:08

Letting zip do the splitting for you will be much easier to automate than trying to figure it out by yourself. If your goal is 20MB zip files, you will have to estimate the compressed size of each file before adding it to the archive. Is there a reason you don't want to just let zip do the splitting for you? Here's how you'd do it with gnu zip:

zip -s 20m -r myzip.zip mydir

This will create 20MB zipped files with incremental index numbers in the filename.

share|improve this answer
1  
Based on OP's comment to another answer, it sounds like he doesn't want zip to automatically split it because then you get a single archive which requires all files to function properly, but he wants each piece to be a complete, usable archive, independent of the others. –  Dave Sherohman Apr 4 '11 at 9:11
    
@Dave Thank you. You got me thoroughly. –  Nam G VU Apr 11 '11 at 6:31

What you're proposing is essentially a variation of the Knapsack Problem, with the added twist that, due to file compression, you don't start off knowing how much of your 20MB "knapsack" each item will occupy.

The trivial solution, of course, would be to simply zip each file independently, but that fails to reduce the file count any, so I suspect it would not be a satisfactory solution.

If I were presented with this problem, I suppose I would start out by compressing each file individually to a temporary location (or in memory, without writing them to disk), just so that I could get an approximate compressed size for each. With that information, it would then be possible to decide which files should be grouped together by any of the standard approaches to the Knapsack Problem and create the actual zip files.

Assuming you have a scripting language available to you and you know how to use it, I would expect this approach to be fairly straightforward to automate; doing it manually would be quite tedious if you have more than a handful of files to deal with...

share|improve this answer
1  
can you not zip with 'no compression'? Looking at the op's "update" it seems the file format is more important than the compression. –  PriceChild Apr 4 '11 at 11:33
    
Heh... Good point. I hadn't considered the use of zip as a simple archive without compressing. –  Dave Sherohman Apr 4 '11 at 13:30
    
@DaveSherohman So how can we do it then? –  Nam G VU Mar 30 '12 at 8:26

Is it possible to use the combination of the commands of find (-exec options) and zip? (If you are on a UNIX/Linux system)

share|improve this answer
    
Can you make it more clearer please? E.g. the combined command itself –  Nam G VU Mar 30 '12 at 8:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.