【问题标题】:How to do recursive copy of files and directories using ant task如何使用 ant 任务递归复制文件和目录
【发布时间】:2021-01-20 01:48:57
【问题描述】:

Ant 有内置的复制任务来复制多个文件。 我试图在 build.xml 文件中定义以下目标

 <target name="copyFile">
        <copy todir="../CHECK">
            <fileset dir=".">
                <patternset id="AllFiles">
                    <include name="*"/>
                </patternset>
        </fileset>
        </copy>
   </target>

它正在复制文件和目录。但是目录中的内容不会被复制,而是目录被复制为空到目标“../CHECK”。 Ant 复制任务是否提供对文件和目录进行递归复制的能力

【问题讨论】:

    标签: ant


    【解决方案1】:

    我找到了答案 包含中的名称模式应该是“**”而不是“*”。它对所有内容进行递归复制

      <target name="copyFile">
                <copy todir="../CHECK">
                    <fileset dir=".">
                        <patternset id="AllFiles">
                            <include name="**"/>
                        </patternset>
                </fileset>
                </copy>
           </target>
    
       
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-16
      • 1970-01-01
      • 1970-01-01
      • 2010-12-13
      • 2011-12-24
      • 1970-01-01
      相关资源
      最近更新 更多