J
Justin C
I'm working on a program to create .tgz archives of catalogue images for
our customers to download. Initially I was doing this:
my $tar = Archive::Tar->new();
foreach my $dir (0..9, 'a'..'z') {
$tar->add_files(glob "$dir/*jpg");
}
$tar->write($fname, COMPRESS_GZIP, "catalogue_images")
This was creating .tgz files much, much larger than the total
uncompressed size of images. I decided to try a different way of
creating the archive, and now do this:
my @files;
foreach my $dir (0..9, 'a'..'z') {
push @files, glob "$dir/*jpg";
}
Archive::Tar->create_archive($fname, COMPRESS_GZIP, @files);
and the file sizes are, as I would expect, much smaller.
Can someone tell me why this is?
Justin.
our customers to download. Initially I was doing this:
my $tar = Archive::Tar->new();
foreach my $dir (0..9, 'a'..'z') {
$tar->add_files(glob "$dir/*jpg");
}
$tar->write($fname, COMPRESS_GZIP, "catalogue_images")
This was creating .tgz files much, much larger than the total
uncompressed size of images. I decided to try a different way of
creating the archive, and now do this:
my @files;
foreach my $dir (0..9, 'a'..'z') {
push @files, glob "$dir/*jpg";
}
Archive::Tar->create_archive($fname, COMPRESS_GZIP, @files);
and the file sizes are, as I would expect, much smaller.
Can someone tell me why this is?
Justin.