使用Ant,我想清理所有扩展名为".dcu"的文件的目录,其中存在一个与扩展名为".pas"的基本名称相同的文件.
我不能简单地删除所有'.dcu'文件 - 其中一些文件无法通过源代码编译来恢复,因为没有相应的'.pas'文件.
如何才能做到这一点?
您可以使用fileset带有globmapper和present选择器的方法来执行此操作,例如:
<delete>
<fileset dir="." includes="*.dcu">
<present targetdir=".">
<mapper type="glob" from="*.dcu" to="*.pas" />
</present>
</fileset>
</delete>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
655 次 |
| 最近记录: |