Skip to content

Instantly share code, notes, and snippets.

@suzuki suzuki/build.xml
Created Mar 26, 2012

Embed
What would you like to do?
Sorted filelist for Phing
<?xml version="1.0" encoding="utf-8" ?>
<project name="sorted-filelist" basedir="." default="all">
<target name="all" depends="use-fileset, use-find" />
<!-- fileset version -->
<!-- no sort -->
<target name="use-fileset">
<foreach param="filename" target="echo-filename">
<fileset dir="./testdir">
<include name="*.txt" />
</fileset>
</foreach>
</target>
<!-- find version -->
<!-- sorted ! -->
<target name="use-find">
<exec command="find ./testdir -name '*.txt' | sort | xargs -n 1 basename | tr '\n' ',' > /tmp/filelist" />
<loadfile property="file-list" file="/tmp/filelist" />
<foreach list="${file-list}" param="filename" target="echo-filename" />
</target>
<target name="echo-filename">
<echo msg="Filename is ${filename}" />
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.