【发布时间】:2010-06-02 11:43:42
【问题描述】:
我有一个简单的 Ant 任务,它列出了一个文件夹中的所有“.png”文件:
<target name="listimages">
<!-- Assume files a A and B -->
<fileset id="dist.contents" dir="${basedir}">
<include name="**/*.png"/>
</fileset>
<pathconvert pathsep="${line.separator}"
property="prop.dist.contents"
refid="dist.contents">
<mapper type="flatten" />
<map from="${basedir}" to=""/>
</pathconvert>
<echo>${prop.dist.contents}</echo>
</target>
打印出来
[echo] A.png
[echo] B.png
但是,我想要的是文件名在每一行出现两次。
[echo] A.png,A.png
[echo] B.png,B.png
我该怎么做?
(这个问题是How can I print a fileset to a file, one file name per line?的后续问题)
【问题讨论】: