七十七点五

----------知其然知其所以然

导航

ant学习之copy命令

<?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 命令
    copy主要用来对文件和目录的复制功能。举例如下:
eg1. 复制单个文件:
<copy file="original.txt" tofile="copied.txt"/>
eg2. 对文件目录进行复制:
<copy todir="../dest_dir">
      <fileset dir="src_dir"/>
 </copy>
eg3. 将文件复制到另外的目录:
<copy file="source.txt" todir="../home/philander"/>
-->

posted on 2014-10-28 10:05  七十七点五  阅读(713)  评论(0编辑  收藏  举报