tags:

views:

32

answers:

1

Using ant, I would like to clean a directory from all files having the extension '.dcu' for which a file exists that has the same basename, but the extension '.pas'.

(I cannot simply delete all '.dcu' files because some of them cannot be restored by compiling from source, because there is no corresponding '.pas' file.)

How can this be done?

+2  A: 

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

<delete>
    <fileset dir="." includes="*.dcu">
        <present targetdir=".">
            <mapper type="glob" from="*.dcu" to="*.pas" />
        </present>
    </fileset>
</delete>
martin clayton
Thank you! That is exactly what I was looking for.
unassigned