<?xml version="1.0" ?><project name="antCopy" default="target1" basedir="../"> <property name="srcFile" value="E:/workspace/AntDemo/ant/test/test01/1.txt"> </property> <property name="destFile" value="E:/workspace/AntDemo/ant/test/test02/3.txt"> </property> <property name="descDir" value="E:/workspace/AntDemo/ant/test/test02" /> <property name="destDir" value="E:/workspace/AntDemo/ant/test/test03" /> <target name="target1"> <echo message=" ant copy from ${srcFile} to ${destFile}" /> <copy file="${srcFile}" tofile="${destFile}"> </copy> <copy file="${srcFile}" todir="${descDir}" /> <copy todir="${destDir}"> <fileset dir="E:/workspace/AntDemo/ant/test/test02"></fileset> </copy> </target></project>
<! --
Copy command
Copy is mainly used to copy files and directories. Example:
Eg1. copy a single file:
<Copy file = "original.txt" tofile = "copied.txt"/>
Eg2. copy the file directory:
<Copy todir = "../dest_dir">
<Fileset dir = "src_dir"/>
</Copy>
Eg3. copy the file to another directory:
<Copy file = "source.txt" todir = "../home/philander"/>
-->
Copy command for ant Learning