<b>This copies all files in directories called images that are located in the directory tree defined by ${src} to the destination directory defined by ${dist}, but excludes all *.gif files from the copy.</b>
<copy todir="${dist}">
<fileset dir="${src}"
includes="**/images/*"
excludes="**/*.gif"
/>
</copy>
<b>The same as the example above, but expressed using nested elements.</b>
<copy todir="${dist}">
<fileset dir="${src}">
<include name="**/images/*"/>
<exclude name="**/*.gif"/>
</fileset>
</copy>
<b>Copy a single file</b>
<copy file="myfile.txt" tofile="mycopy.txt"/>
<b>Copy a single file to a directory</b>
<copy file="myfile.txt" todir="../some/other/dir"/>
<b>Copy a directory to another directory</b>
<copy todir="../new/dir">
<fileset dir="src_dir"/>
</copy>
<b>Copy a set of files to a directory</b>
<copy todir="../dest/dir">
<fileset dir="src_dir">
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy todir="../dest/dir">
<fileset dir="src_dir" excludes="**/*.java"/>
</copy>
<b>Copy a set of files to a directory, replacing @TITLE@ with Foo Bar in all files.</b>
<copy todir="../backup/dir">
<fileset dir="src_dir"/>
<filterset>
<filter token="TITLE" value="Foo Bar"/>
</filterset>
</copy>
<b>Collect all items from the current CLASSPATH setting into a destination directory, flattening the directory structure.</b>
<copy todir="dest" flatten="true">
<path>
<pathelement path="${java.class.path}"/>
</path>
</copy>
<b>Copies some resources to a given directory.</b>
<copy todir="dest" flatten="true">
<resources>
<file file="src_dir/file1.txt"/>
<url url="http://ant.apache.org/index.html"/>
</resources>
</copy>
<b>Copies the two newest resources into a destination directory.</b>
<copy todir="dest" flatten="true">
<first count="2">
<sort>
<date xmlns="antlib:org.apache.tools.ant.types.resources.comparators"/>
<resources>
<file file="src_dir/file1.txt"/>
<file file="src_dir/file2.txt"/>
<file file="src_dir/file3.txt"/>
<url url="http://ant.apache.org/index.html"/>
</resources>
</sort>
</first>
</copy>
<b>copy a set of files</b>
<copy todir="${temp.dir.classes}">
<fileset dir="${src.dir}">
<include name="**/*.xml"/>
<include name="**/*.xsl"/>
<include name="**/*.properties"/>
</fileset>
</copy>
<b>Ant copy task examples</b>
<copy file="${resources.dir}/MANIFEST.MF" tofile="${temp.dir.meta-inf}/MANIFEST.MF" overwrite="true" />
<copy file="${resources.dir}/managed-beans.xml" tofile="${temp.dir.web-inf}/managed-beans.xml" overwrite="true" />
<copy file="${resources.dir}/navigation-rules.xml" tofile="${temp.dir.web-inf}/navigation-rules.xml" overwrite="true" />
<copy file="${resources.dir}/monitoring-managed-beans.xml" tofile="${temp.dir.web-inf}/monitoring-managed-beans.xml" overwrite="true" />
<copy file="${resources.dir}/monitoring-navigation-rules.xml" tofile="${temp.dir.web-inf}/monitoring-navigation-rules.xml" overwrite="true" />
<copy file="${resources.dir}/faces-config.xml" tofile="${temp.dir.web-inf}/faces-config.xml" overwrite="true" />
<copy file="${resources.dir}/log4j.properties" tofile="${temp.dir.classes}/log4j.properties" overwrite="true" />
<copy file="${resources.dir}/commons-logging.properties" tofile="${temp.dir.classes}/commons-logging.properties" overwrite="true" />
fileset dir="${config.deploy.dir}">
<include name="**"/>
<exclude name="apps/"/>
</fileset>