commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Al Scherer (JIRA)" <>
Subject [jira] Created: (LANG-382) Retrieve Directory File List in Timestamp Order
Date Tue, 04 Dec 2007 21:09:42 GMT
Retrieve Directory File List in Timestamp Order

                 Key: LANG-382
             Project: Commons Lang
          Issue Type: New Feature
         Environment: Java SE 5.  Windows and SuSe Linux.
            Reporter: Al Scherer

I searched your current Commons-Lang issues/feature requests and did not find the following
so I'd like to propose it as a feature request.
Given a filename filter and dir name, the new method would return a List<File> of the
files that match the filter in last-modified timestamp order.  

I've not found code out there that does this.  
Sun explicitly does not - from the Sun Java SE 5 API Javadocs, File's listFiles() method descriptions
include the following disclaimer:
        "There is no guarantee that the name strings in the resulting array will appear in
any specific order; they are not, in particular, guaranteed to appear in alphabetical order."

I needed the files in last-modified order so I wrote code to do it.  I would be glad to share
the code with the commons project if you feel it would be worthwhile.  The signature would
- public List<File> getFileListModifiedTimestampOrder(FilenameFilter filter, String

I've already written, tested and used code to do this.

There are additional flavors that might be worthwhile, too.
- public List<File> getFileListModifiedTimestampOrderReversed(FilenameFilter filter,
String dirName)
- public List<File> getFileListNameOrder(FilenameFilter filter, String dirName)
- public List<File> getFileListNameOrderReversed(FilenameFilter filter, String dirName)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message