create zip file of size 0 ?

M

maby_n

Hi. Is it possible to create an empty zip file of size 0 ?

I use the Archive:: Zip as follows:

use Archive::Zip;
my $zip = Archive::Zip->new();
$zip->writeToFileNamed('xxx.zip');

But this creates a file of size is 1 KB. The script is run on a PC if
that makes any difference. Is there a way to get the size down to 0?

Thankful for help
 
A

Anno Siegel

Hi. Is it possible to create an empty zip file of size 0 ?

I use the Archive:: Zip as follows:

use Archive::Zip;
my $zip = Archive::Zip->new();
$zip->writeToFileNamed('xxx.zip');

But this creates a file of size is 1 KB. The script is run on a PC if
that makes any difference. Is there a way to get the size down to 0?

A file must contain a magic number (and other stuff, like a "central
directory") to be a zip archive. It can't be 0 bytes long even if
it's empty.

If you want a zero-length file, write a zero-length file without
Archive::Zip.

Anno
 
B

Brian Wakem

Hi. Is it possible to create an empty zip file of size 0 ?

I use the Archive:: Zip as follows:

use Archive::Zip;
my $zip = Archive::Zip->new();
$zip->writeToFileNamed('xxx.zip');

But this creates a file of size is 1 KB. The script is run on a PC if
that makes any difference. Is there a way to get the size down to 0?

Thankful for help


open(ZIP, "+> xxx.zip");
close ZIP;
 
U

usenet

a question

Your question was multi-posted to other newsgroups. That's rude. It's
(generally) impolite to cross-post, but it's downright rude to
multi-post.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top