3

I'm looking for archive software with these requirements:

  • Ability to archive files into multiple .zip files, each holding a max of 10 files
  • Compatible with Windows 10
  • Please note this site is about recommending software, not assets like howtos, manuals, etc. – so asking how to achieve that with WinRAR on Windows 10 is off-topic here. It might be a fitting question on SuperUser (please check with their /help/on-topic page before posting there). From your intention, a question fitting here would be asking for "software running on windows 10 that can archive files in a directory into multiple zip files, each holding 10 files". – Izzy Jan 6 '16 at 11:09
  • 1
    This is starting to look more like a software recommendation now. – Steve Barnes Jan 7 '16 at 6:49
  • @Lafix Do you have any preference regarding the names of the resulting zip files? – mguassa Jan 7 '16 at 11:45
  • I dont understand the use case. E.g. you have 20 files, 10 files at 1 GB, 10 files at 1 kB. Why would you want 1 zip archive with 10 GB and another one with 10 kB? It makes much more sense to split by size. – Thomas Weller Jan 8 '16 at 13:55
2

The request is quite specific, I'm not sure if something with that functionality exists out-of-the-box.

My suggestion would be to use something like a custom script, which would also give you good flexibility.

Since you are using Windows, I quickly developed a simple PowerShell script for you.

Create a .ps1 text file (e.g. Create-MultiZip.ps1) with the following content:

param
(
    # The input folder containing the files to zip
    [Parameter(Mandatory = $true)]
    [string] $InputFolder,

    # The output folder that will contain the zip files
    [Parameter(Mandatory = $true)]
    [string] $OutputFolder
)

Set-Variable SET_SIZE -option Constant -value 10
$i = 0
$zipSet = 0

Get-ChildItem $InputFolder | ForEach-Object {
    $zipSetName = "archive" + ($zipSet + 1) + ".zip"
    Compress-Archive -Path $_.FullName -Update -DestinationPath "$OutputFolder\$zipSetName"
    $i++;

    if ($i -eq $SET_SIZE) {
        $i = 0;
        $zipSet++;
    }
}

Then run it in a PowerShell environment, providing the folder containing the files you want to zip, followed by the folder which will contain the zip files. For example:

Create-MultiZip.ps1 C:\tmp\input C:\tmp\output

What does the script do?
Basically it gets a list of all the files in the input folder, then each file is added to the archive1.zip file in the output folder, until the prefixed set size is reached. At that point, a new archive2.zip file is created, the same as before... and so on, until all the files in input have been processed.
Note that the resulting files are called archive<n>.zip, where n represents the progressive number for each zip file.

The heart of the script is the Compress-Archive cmdlet. It was recently introduced with PowerShell 5.0, which comes by default in Windows 10.

If you know Powershell a bit, the script can be easily improved, for example by adding a CompressionLevel, or some text output to the console.

It's also straightforward to change the number of files you want in each set, you just need to modify the constant value at the following line:

Set-Variable SET_SIZE -option Constant -value 10

I've tested the script briefly and it works fine - it goes without saying that you should give it a go on some test files first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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