Well, there is the <script> task which can help you make this happen. It's an optional Ant task, and you need to include in a few additional jarfiles when you run Ant. < http://ant.apache.org/manual/install.html#librarydependencies>. The Script macro can be found here: < http://ant.apache.org/manual/OptionalTasks/script.html>.
I've never used the script macro, so I can't help you there, but you are taking on a rather complex task. You need to collect the file names, create a "sortkey" for each file name, sort the files on that key, and then recall these names one-by-one. There is no "numeric sort" command I know of in most languages, so you'll have to do that yourself. You'll need to do that in an "approved" language which may not be a language you are familiar with. If you are a decent Java developer, you could try writing a custom Ant task. Information about that can be found in the Ant Manual here: < http://ant.apache.org/manual/tutorial-writing-tasks.html>. Lots of luck with your endeavor. On Mon, Jun 22, 2009 at 10:55 PM, Henry Suhatman <he...@jawasoft.com> wrote: > Yes it way to solve, but i don't want fill zero in first filename, if i > write new task i don't know where i had started :( > Anyone can suggest? Please advice me. > > Thx. > > > David Weintraub wrote: > >> 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 >>> >>> >>> >>> >> >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > > -- David Weintraub qazw...@gmail.com