开发者

How can I delete files with one extension for corresponding files with some other extension, using Ant?

开发者 https://www.devze.com 2022-12-20 06:11 出处:网络
Using Ant, I would like to clean a directory of all files having the extension \'.dcu\' for which a file exists that has the same basename with the extension \'.pa开发者_开发百科s\'.

Using Ant, I would like to clean a directory of all files having the extension '.dcu' for which a file exists that has the same basename with the extension '.pa开发者_开发百科s'.

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

How can this be done?


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号