Skip to content

Ant: Copying files

Using the copy task.

<copy todir="target/xml/dir">
<fileset dir="src/xml">
<include name="**/*.xml"/>
</fileset>
</copy>

Copies all xml files found in src/xml to target/xml/dir

The different is handy when you want to copy only files that have had their content modified, and ignore the timestamp. For example:

<copy todir="${dist.dir}">
<fileset dir="${build.dir}" includes="**/*.*">
<different targetdir="${dist.dir}" ignoreFileTimes="true"/>
</fileset>
</copy>