How can I delete files with one extension for the corresponding files using another extension using Ant?

Using Ant, I would like to clear the directory of all files with the extension '.dcu', for which there is a file that has the same base name with the extension '.pas'.

I cannot just delete all .dcu files - some of them cannot be restored by compilation from the source, because there is no corresponding .pas file.

How can I do that?

+4
source share
1 answer

You can do this using fileset with glob mapper and present , for example:

 <delete> <fileset dir="." includes="*.dcu"> <present targetdir="."> <mapper type="glob" from="*.dcu" to="*.pas" /> </present> </fileset> </delete> 
+8
source

Source: https://habr.com/ru/post/1301201/


All Articles