Examples

On the one hand, CopyTask can be used to copy file by file:

<copy file="somefile.txt" tofile="/tmp/anotherfile.bak" overwrite="true"/>

Additionally, CopyTask supports Filesets, i.e. you can easily include/exclude one or more files. For more information, see Core Types -- pay particular attention to the defaultexcludes attribute. Core mappers and Core filters are also supported by CopyTask, so you can do almost everything that needs processing the content of the files or the filename.

<copy todir="/tmp/backup" >
  <fileset dir=".">
    <include name="**/*.txt" />
    <include name="**/*.doc" />
    <include name="**/*.swx" />
  </fileset>
  <filelist dir="." files="test.html"/>
</copy>
<copy todir="build" >
  <fileset defaultexcludes="false" expandsymboliclinks="true" dir=".">
    <include name="**/*.php" />
  </fileset>
</copy>