Login  Register

Re: properly sorted file list in java on Mac

Posted by Jim Cant on Nov 26, 2007; 2:39pm
URL: http://imagej.273.s1.nabble.com/properly-sorted-file-list-in-java-on-Mac-tp3697924p3697926.html

As you can see from the other response, both Windows and Mac are 'right' as you are only promised a list; that Mac's comes sorted is only fortuitous.

One gotcha to watch for: If you have a numeric component to the file names, they may sort in an unexpeced way.  Files F1, F2,...F10, F11... will sort at F1,F10,F11, F2.  which can be problem if the file set needs to be ordered properly (time series, images of serial sections, etc.).  This can be  avoided by using a fixed width for the numeric portion and padding with '0', i.e.  F01, F02...F11

Curtis Rueden wrote
...snip...
> access in order.  And why would the Java code for a file list work right
> on Windows and not on Mac?
>
> Thanks for any advice,
> Bill
>