I don't see anything in the Ant manual that would help you much with what
you want to do.

Ant's Zip task doesn't seem to have any way to determine the size of a Zip
file and I don't see anything that will *directly* help you split a single
Zip file into several smaller ones.

Somehow or another, I think you will need to write a program to determine
the size of the original zip file, determine which files should be grouped
together into the smaller zip files, then,  unzip them from the original
file and create new smaller zip files using the files within the original
zip. However, you may not be able to guarantee that the new zip files are
equal in size, just that they are less than or equal to a size that you set
within the program. This is reasonable: if your original zip file contains
three files, 10 MB, 2 MB, and 50 KB in size, then the resulting zip files
won't be equal in size; you might put the 10 MB file into a new zip and then
put the 2 MB and 50 KB file into another zip. You can't do much else without
breaking the larger file(s) into smaller ones which may be hard to
re-assemble later. In any case, once you have determined which files from
the original zip are grouped together within the smaller zips, you could
certainly use Ant to do the work of actually creating the smaller zips but I
don't think there is any way to get Ant to figure out which files needed to
be grouped into smaller zips; that requires programming.

A Java program can do everything that you need but if you don't know Java,
you will have to do it in a language that you know which has the ability to
manipulate zip files. I don't know of any languages other than Java that can
manipulate zip files but I only know a few languages. C might very well do
what you want to do.

It's also possible that someone has written a tool along the lines that you
want. I'm not aware of such a tool but there are a lot of tools out there
and I don't know about many of them.

Is it absolutely essential that the smaller files are zip files or would it
be acceptable for the smaller files to be some other format that can be
merged together into a zip later? If the smaller files don't have to be zip
files, I can suggest a fairly simple solution: get a file splitter program.
I happen to have a freeware one that I downloaded called JSplit: it slices a
given input file, even a zip file, into smaller files that are less than or
equal to 360 KB, 720 KB, 1.20 MB, or 1.44 MB. I simply give it the name of
the file which needs to be split and specify the directory into which the
smaller files are written; JSplit writes the smaller files into the
specified directory and generates a simple batch file that merges them back
together again. I can then send the smaller files to someone, along with the
batch file, and all they have to do is run the batch file: the result is my
original zip file. (I actually split a 687 KB zip file into 360 KB chunks,
then merged them again and compared the new zip with the old zip via a file
compare utility: the two files were identical in a binary comparison.)
JSplit was written in order to split larger files onto floppy disks. JSplit
works only on Windows but there are possibly similar programs for the
operating system(s) you are using. Other file splitter programs may let you
control the size of the smaller files so that they are different from the
choices permitted within JSplit.

If you need a tool that splits the original zip file into smaller zip files,
I could do it for you, in Java, but it would take time and it wouldn't be
free. However, it would run on any platform that supports Java which might
make it worth the money. If a file splitter like JSplit isn't an acceptable
approach, your best bet is probably to ask around on technical newsgroups to
see if there is anything out there that does what you want.

Rhino

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <user@ant.apache.org>
Sent: Tuesday, October 18, 2005 10:23 AM
Subject: Size of zip file



Dear All,
          I would like to know that if is possible that I can take a
size of zip file, is there any such task in ANT by using which I can
know the size of a zip file or folder.
And also want to know that is I can split any zip file into desirable
equal size?
Any help will be highly appreciated.

Regards,
Pritesh





Confidentiality Notice

The information contained in this electronic message and any attachments to
this message are intended
for the exclusive use of the addressee(s) and may contain confidential or
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or
[EMAIL PROTECTED] immediately
and destroy all copies of this message and any attachments.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.0/134 - Release Date: 14/10/2005




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.0/134 - Release Date: 14/10/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to