commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stian Soiland-Reyes <st...@apache.org>
Subject Re: [IO] question: list files ordered natively from the fs?
Date Mon, 06 Jun 2016 13:03:38 GMT
Does the java.nio.newDirectoryStream give you the expected file system order?

You can compare with python os.listdir:

stain@biggiebuntu:~/rc/incubator-taverna-common-activities$ python -c
"import os; print(os.listdir('.'))"
['taverna-spreadsheet-import-activity', 'release.properties',
'taverna-external-tool-activity', '.git', 'taverna-wsdl-generic',
'taverna-xpath-activity', 'pom.xml', 'taverna-beanshell-activity',
'NOTICE', 'pom.xml.releaseBackup', 'README.md',
'taverna-rest-activity', 'DISCLAIMER', 'taverna-interaction-activity',
'.travis.yml', '.gitignore', 'taverna-wsdl-activity', 'LICENSE',
'target']

Which at least in Linux should match the order of: ls -Ul


We've talked about updating IO to use Java 7, then
java.nio.newDirectoryStream can be used and provide the native
(possibly weird, but faster) order.

On 6 June 2016 at 11:53, Sergio Fernández <wikier@apache.org> wrote:
> Hi,
>
> I've just needed a simple feature, but it should not be that simple if
> there is not helper available in Commons IO...
>
> I'd like to get the list of files of a directory ordered from the
> filesystem (data, name, etc). I think FileUtils does not provide such
> feature, and all solutions I found are quite naive (order in memory the
> name and order them).
>
> So, I'd like to ask if there is a good reason for that, probably not enough
> support from the IO/NIO stdlib. But I'd like to know the context before I
> give it a try ;-)
>
> Cheers,
>
> --
> Sergio Fernández
> Partner Technology Manager
> Redlink GmbH
> m: +43 6602747925
> e: sergio.fernandez@redlink.co
> w: http://redlink.co



-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons
http://orcid.org/0000-0001-9842-9718

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message