Created
March 26, 2012 05:14
-
-
Save suzuki/2203147 to your computer and use it in GitHub Desktop.
Sorted filelist for Phing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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