2011-05-25 24 views
1

我需要編寫一個ant任務來選擇性地刪除文件。使用Ant根據另一個文件的存在刪除文件

在目錄中,我有以下罐子:

acme.jar 極致,201105251330.jar

我想是因爲極致刪除acme.jar - *罐子存在。

這是我已經試過:

<target name="-check-use-file"> 
<available property="file.exists"> 
<filepath> <fileset dir="."> 
    <include name="./test-*.jar"/> </fileset> 
</filepath> 
</available> 
</target> 
<target name="use-file" depends="-check-use-file" if="file.exists"> 
<!-- do something requiring that file... --> 
</target> 

感謝

回答

1

看一看If/Unless Attributes,給出的例子似乎那裏是你正在尋找什麼。

+0

我試過了,但是問題是不支持文件屬性的通配符。 – FinalFive 2011-05-26 17:24:31

+0

您可能想更新您的問題,因爲評論中的代碼幾乎是不可讀的。 – mindas 2011-05-26 19:12:30

+0

更改了原始問題 – FinalFive 2011-05-26 20:01:10

相關問題