使用Path而不是FileSet的Ant Copy任务

cn1*_*n1h 2 ant copy path

我正在使用Ant 1.7,想要从不同路径复制文件(它们没有关系,所以我不能使用include选择器将它们从根目录中过滤掉)。我尝试使用而不是<path>内部,因为使用i可以指定不可能的多路径。我的蚂蚁脚本看起来像这样,但是不起作用。<copy><fileset><path><fileset>

<target name="copytest">
    <!-- copy all files in test1 and test2 into test3 -->
    <copy todir="E:/test3">
        <path>
            <pathelement path="C:/test1;D:/test2"></pathelement>
        </path>
    </copy>
</target>
Run Code Online (Sandbox Code Playgroud)

有人知道如何使用<path>内部<copy>吗?也许有人建议如何在没有选择器的情况下从不同来源复制文件?

顺便说一句,我不想​​对源目录进行硬编码,它们将从适当的文件中读取,因此不应考虑<fileset>在内部编写多重目录<copy>

提前致谢!

alb*_*ban 5

这只有在工作的flatten属性设置为true

<copy todir="E:/test3" flatten="true">
    <path>
        <pathelement path="C:/test1;D:/test2"></pathelement>
    </path>
</copy>
Run Code Online (Sandbox Code Playgroud)

ExamplesAnt Copy任务文档的部分中进行了说明