How can I print a fileset to a file, one file name per line?

后端 未结 2 1827
既然无缘
既然无缘 2020-12-23 16:34

I have a populated fileset and I need to print the matching filenames into a text file.

I tried this:



        
相关标签:
2条回答
  • 2020-12-23 16:59

    Use the PathConvert task:

    <fileset id="myfileset" dir="../sounds">
        <include name="*.wav" />
        <include name="*.ogg" />
    </fileset>
    
    <pathconvert pathsep="${line.separator}" property="sounds" refid="myfileset">
        <!-- Add this if you want the path stripped -->
        <mapper>
            <flattenmapper />
        </mapper>
    </pathconvert>
    <echo file="sounds.txt">${sounds}</echo>
    
    0 讨论(0)
  • 2020-12-23 17:12

    Since Ant 1.6 you can use toString:

    <echo file="sounds.txt">${toString:myfileset}</echo>
    
    0 讨论(0)
提交回复
热议问题