tags:

views:

170

answers:

3

Hi, I'm trying to copy a directory with ant task.

I am a newbie in ant; my current solution is:

<copy todir="${release_dir}/lib">
   <fileset dir="${libpath}" />
</copy>

I'm wondering if there is a better and shorter way to accomplish the same thing?

Thanks in advance

A: 

This will do it:

<copy todir="directory/to/copy/to">
    <fileset dir="directory/to/copy/from"/>
</copy>

The ant manual is your friend: ANT Manual, in this case: Copy Task

SimonC
A: 

From http://ant.apache.org/manual/CoreTasks/copy.html:

<copy todir="../new/dir">
  <fileset dir="src_dir"/>
</copy>
dave
+3  A: 

Hello.

First of all, those are the examples from ant documentation:

Copy a directory to another directory

<copy todir="../new/dir">
  <fileset dir="src_dir"/>   
</copy>

Copy a set of files to a directory

<copy todir="../dest/dir">
  <fileset dir="src_dir">
    <exclude name="**/*.java"/>
  </fileset>
</copy>

<copy todir="../dest/dir">
  <fileset dir="src_dir" excludes="**/*.java"/>   
</copy>

Copy a set of files to a directory, appending .bak to the file name on the fly

<copy todir="../backup/dir">
  <fileset dir="src_dir"/>
  <globmapper from="*" to="*.bak"/>   
</copy>

Secondly, here is the whole documentation about copy task.

zeroDivisible