You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Joël FÉRAUD <jo...@france.sun.com> on 2003/03/07 18:42:19 UTC

How to sort files contained in an Ant fileset?

Hi,

I would like to alphabetically sort the list of files returned by a fileset so that I can pass this sorted list as parameter of a command where order of parameters has some impact.

In fact I would like to achieve the same result as the Unix command:
find . -name "*.xml" | sort

For now, I use the build sequence below, but it appears that the list of files I get in ${working.xml.files} is not alphabetically sorted. I did not find a way to achieve this with Ant? I would like to avoid to do an exec and call the Unix sort command...

[...]
	<fileset id="fileset.working.xml.files"
		 dir="${dir.working}" 
		 >
	    <include name="*.xml" />
	</fileset>
	<pathconvert pathsep=" " 
		     property="working.xml.files"
		     refid="fileset.working.xml.files"
		     >
	</pathconvert>
	<java	classname="com.sun.tgxml.tools.testgen.TestGen"
		fork="true"
		failonerror="true"
		>
	    <jvmarg    value="-Dtck.build.propfile=${file.testgen-properties}" />
            <classpath refid="classpath.tobuild.indexes" />
	    <arg       value="-log" />
	    <arg        line="-logfile ${log.build.testgen}" />
	    <arg       value="-debug" />
	    <arg        line="-o ${dir.working}" />
	    <arg        line="${working.xml.files}" />
        </java>
[...]


Thanks,
Joel

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Joel Feraud			Sun Microsystems, Inc.
joel.feraud@sun.com		180, avenue de l'Europe
Tel: +33 476 188 325		ZIRST de Montbonnot
				38334 SAINT-ISMIER Cedex
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -