O SpinZip é a ferramenta certa para nenhuma compressão. Eu queria usar compressão, então o resultado foi insatisfatório. O Zipsplit não funciona para arquivos acima de 2 GB, então acabei escrevendo meu próprio script perl rápido e sujo, que faz o seu trabalho. Sua adiciona arquivos para o arquivo, desde que o arquivo + arquivo seja menor que o máximo. tamanho especificado:
# Use strict Variable declaration
use strict;
use warnings;
use File::Find;
# use constant MAXSIZE => 4700372992; # DVD File size
use constant MAXSIZE => 1566790997; # File size for DVD to keep below 2GB limit
# use constant MAXSIZE => 100000000; # Test
use constant ROOTDIR => 'x:/dir_to_be_zipped'; # to be zipped directory
my $zipfilename = "backup"; # Zip file name
my $zipfileext = "zip"; # extension
my $counter = 0;
my $zipsize = undef;
my $flushed = 1;
my $arr = [];
find({wanted =>\&wanted, no_chdir => 1}, ROOTDIR);
flush(@{$arr});
# Callback function of FIND
sub wanted {
my $filesize = (-s $File::Find::name);
LABEL: {
if ($flushed) {
$zipsize = (-s "$zipfilename$counter.$zipfileext");
$zipsize = 0 unless defined $zipsize;
printf("Filesize Zip-File %s: %d\n",
"$zipfilename$counter.$zipfileext", $zipsize);
$flushed = 0;
if (($zipsize + $filesize) >= MAXSIZE) {
$counter++;
$flushed = 1;
printf("Use next Zip File %d, Filesize old File: %d\n",
$counter, ($zipsize + $filesize));
goto LABEL;
}
}
}
if ( $zipsize + $filesize < MAXSIZE ) {
printf("Adding %s (%d) to Buffer %d (%d)\n",
$File::Find::name, $filesize, $counter, $zipsize);
push @{$arr}, $File::Find::name;
$zipsize += $filesize;
}
else {
printf("Flushing File Buffer\n");
flush(@{$arr});
$flushed = 1;
$arr = [];
goto LABEL;
}
}
# Flush File array to zip file
sub flush {
# open handle to write to STDIN of zip call
open(my $fh, "|zip -9 $zipfilename$counter.$zipfileext -@")
or die "cannot open < $zipfilename$counter.$zipfileext: $!";
printf("Adding %d files\n", scalar(@_));
print $fh map {$_, "\n"} @_;
close $fh;
}