copy all files from one directory and subdirectori

2019-04-11 18:37发布

问题:

Hi all please help ASAP...Here is my code for copying all .txt files from one location to other:

<copy todir="../new/dir">
    <fileset dir="C:/build/build">
        <include name="**/*.txt"/>
    </fileset>
</copy>

Altough it is working fine, it is copying files correctly but the problem is that it is maintainig the directory structure for non-empty directories at destination also, I want all the files under "C:/build/build" and its sub-directories shoul

回答1:

From what you've written maybe you want to flatten the files?

http://ant.apache.org/manual/Tasks/copy.html

<copy todir="../new/dir" flatten="true">
    <fileset dir="C:/build/build">
        <include name="**/*.txt"/>
    </fileset>
</copy>


标签: ant