tags:

views:

120

answers:

1

Is it possible to use Ant to copy all the files (not folders) from a hierarchy of folders into one destination folder?

For instance, I have a tree like this:

res
|-images
|  |-fg.png
|  +-bg.png
+-sounds
   +-music.mp3

And I would like a result like this:

data
|-fg.png
|-bg.png
+-music.mp3

The way things are named, filename conflicts are not an issue.

Is this possible to do with Ant?

+1  A: 

You can use the flatten attribute of the copy task to accomplish this. You can read more at http://ant.apache.org/manual/Tasks/copy.html.

VeeArr
Thanks. I also added includeEmptyDirs="false" so that the flattened directories weren't copied.
Sam Washburn