3

I want to copy few files into an existing zip file using ANT script.

Is there any task available for that? Or do I need to unzip the zip file then copy the needed files and zip again?

oers
  • 18,436
  • 13
  • 66
  • 75
Anand
  • 2,239
  • 4
  • 32
  • 48

2 Answers2

8

Straight from the documentation of the zip task:

The update parameter controls what happens if the ZIP file already exists. When set to yes, the ZIP file is updated with the files specified. (New files are added; old files are replaced with the new versions.)

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
3

If you have an existing zip file called perlscr.zip, you can add for example, a file called backup.sh in the shellscr directory using the Ant Zip task:

<zip destfile="perlscr.zip"
    basedir="shellscr"
   includes="backup.sh"
   update="true"/> 
Wenwen
  • 51
  • 2