【问题标题】:How to list all zip files in a specified directory?如何列出指定目录中的所有 zip 文件?
【发布时间】:2012-12-31 07:47:16
【问题描述】:

我正在尝试检索目录中存在的所有 zip 文件的列表。

我有一个目录${src},其中包含一些 zip 文件,我正在使用以下代码

<target name="test">  
<dirset id="dist.contents" dir="${src}" includes="*.zip"/>  
<property name="prop.dist.contents" refid="dist.contents"/>  
<echo message="${prop.dist.contents}" />  
</target>  

但它只回显 null。

我也试过includes="*",但没有任何区别。

我使用的是 Ant 1.7.0 版。

【问题讨论】:

    标签: ant fileset


    【解决方案1】:

    the documentation中所写:

    DirSet 是一组目录。

    所以既然你想要压缩 文件,你应该使用 FileSet。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-13
      • 2018-11-10
      • 2014-03-08
      相关资源
      最近更新 更多