Well, it is sorting the files by name. Unfortunately, it is sorting them in
ASCII dictionary order.

The easiest way (and maybe the only way) is to zero fill in the names of
these files when you create them, so that you have 001.sql and 010.sql
instead of 1.sql and 10.sql.

That way, they'll sort in the order you want:

001.sql
002.sql
010.sql
011.sql

I looked at Resource Collections, and there is a <sort> resource collection,
but nothing to customize your sort order the way you want.

You could write your own task or script, but it's probably not worth it.


On Fri, Jun 19, 2009 at 7:15 PM, Henry Suhatman <he...@jawasoft.com> wrote:

> Hi all,
>
> I have use foreach task from ant-contrib, the output like this
> 1.sql
> 10.sql
> 11.sql
> 2.sql
>
> And, i want to sort file name like this:
> 1.sql
> 2.sql
> 10.sql
> 11.sql
>
> ----------------------------------------------------------------------------
> This is my code :
>
> ----------------------------------------------------------------------------
> <project name="check" default="testing">
>   <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
>   <target name="testing">
>       <foreach param="file" target="loop">
>           <path>
>               <fileset dir="army">
>                   <filename name="*.sql" />
>               </fileset>
>           </path>
>       </foreach>
>   </target>
>   <target name="loop">             <echo>${file}</echo>
>   </target>
> </project>
> -------------------------------------------------------------------------------
>
> What should do to solve this problem?
>
> Thanks & Regards,
>
>
>
> Henry
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
> For additional commands, e-mail: user-h...@ant.apache.org
>
>


-- 
David Weintraub
qazw...@gmail.com

Reply via email to