Alex B
Alex B

Reputation: 1019

How do I create a fileset in Apache Ant that includes child files but exclude the containing directory?

I am able to create a fileset which includes certain directories. I am including this fileset to a copy. I want to take the child file and copy it without taking the parent folder.

My source structure is:

root

So I want script.js and script2.js copied, but in the destination directory I get Folder2 and Folder3 included.

I'm out of depth. Help would be appreciated.

Upvotes: 0

Views: 383

Answers (1)

Rebse
Rebse

Reputation: 10377

Simply use copy task with flatten attribute set to true :

Ignore the directory structure of the source files, and copy all files into the directory specified by the todir attribute. Note that you can achieve the same effect by using a flatten mapper.

Upvotes: 1

Related Questions