Copy all files from one directory and subdirectories to one place

Here is my code for copying all .txt files from one place to another:

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

Although it works fine, it copies files correctly, but the problem is that it supports the directory structure for non-empty directories in the destination, I want all the files to be in the "C: / build / build" folder and its Shoul subdirectories

+3
source share
1 answer

From what you wrote, maybe you want to flatten 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>
+11
source

All Articles