xml - Copy subdirectories if they contain a specific file in Ant -


really new ant , have been trying figure out not...

let have structure :

 root |-data   |-dir1      |-include.xml      |-subdir1        |-file1        |-file2        |-include.xml      |-subdir2   |--dir2      |-file1      |-include.xml   |--dir3   |--dir4      |-file1      |-include.xml   |--dir5 |-build.xml |-other files 

i'd copy files @ root (which pretty simple filtering). the troubles come : want copy subdirectories of data if contain file, here named include.xml. here destination folder should after copying

 root |-data   |-dir1      |-include.xml      |-subdir1        |-file1        |-file2        |-include.xml   |--dir2      |-file1      |-include.xml   |--dir4      |-file1      |-include.xml |-build.xml |-other files 

as can see, /data/dir3, /data/dir5 , /data/dir1/subdir1 have not been copied, because did not contain include.xml file.

it might simple not find way it, property , available being set understood globally ?

i don't think there exist predefined property in ant because requirements specific.

you may use <foreach> task ant-contrib , write recursive target performs copy.

or may implement recursive solution in javascript using <script language="javascript"> . in case don't need additional libraries.

yet solution may copy , delete directories don't contain include.xml.

you may find examples here.


Comments