You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jamesburn <Ja...@oup.com> on 2016/08/02 10:40:58 UTC

sortBy=file:name for numerically named files

Hi

I am generating a bunch (sometimes 1000s) of files which are numerically
numbered: 1.xml, 2.xml, 3.xml ...

When I sort by filename in Windoes explorer/Web server they appear in
correct number order.

I want to process them in this order: 1,2,3 etc.

When I start to collected process them using camel ftp, and sortBy=file:name
they are processed in the order
 1.xml, 10.xml, 100.xml, 101.xml, 102.xml

How can I get Camel or the ftp server to sort the files in numerical order?
I thought of adding 0s to the front of the filenames, though this could get
rather clumsy in my script which generates them!

This is running on ServiceMix 5.1.1, Camel 2.13.2

Thanks
James



--
View this message in context: http://camel.465427.n5.nabble.com/sortBy-file-name-for-numerically-named-files-tp5785862.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: sortBy=file:name for numerically named files

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Aug 2, 2016 at 6:03 PM, jamesburn <Ja...@oup.com> wrote:
> Hi
>
> Thanks for this Claus. I thought I'd be able to work something out behind
> the scenes to make this work. I guess i wondered if this was a standard
> option that I'd missed.
>
> In the end it was a 2 liner to hack my file production scripts to put
> leading zeros in front of the file number names. This makes them sort
> correctly.
>

Yeah that is a better solution, then the files can be sorted naturally.


> Cheers as always.
>
> James
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/sortBy-file-name-for-numerically-named-files-tp5785862p5785895.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: sortBy=file:name for numerically named files

Posted by jamesburn <Ja...@oup.com>.
Hi

Thanks for this Claus. I thought I'd be able to work something out behind
the scenes to make this work. I guess i wondered if this was a standard
option that I'd missed.

In the end it was a 2 liner to hack my file production scripts to put
leading zeros in front of the file number names. This makes them sort
correctly.

Cheers as always.

James



--
View this message in context: http://camel.465427.n5.nabble.com/sortBy-file-name-for-numerically-named-files-tp5785862p5785895.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: sortBy=file:name for numerically named files

Posted by Claus Ibsen <cl...@gmail.com>.
You can implement your own sort logic, and configure the endpoint to
use yours, eg the sorter option: http://camel.apache.org/file2

On Tue, Aug 2, 2016 at 12:40 PM, jamesburn <Ja...@oup.com> wrote:
> Hi
>
> I am generating a bunch (sometimes 1000s) of files which are numerically
> numbered: 1.xml, 2.xml, 3.xml ...
>
> When I sort by filename in Windoes explorer/Web server they appear in
> correct number order.
>
> I want to process them in this order: 1,2,3 etc.
>
> When I start to collected process them using camel ftp, and sortBy=file:name
> they are processed in the order
>  1.xml, 10.xml, 100.xml, 101.xml, 102.xml
>
> How can I get Camel or the ftp server to sort the files in numerical order?
> I thought of adding 0s to the front of the filenames, though this could get
> rather clumsy in my script which generates them!
>
> This is running on ServiceMix 5.1.1, Camel 2.13.2
>
> Thanks
> James
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/sortBy-file-name-for-numerically-named-files-tp5785862.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2