commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <>
Subject [jira] Updated: (IO-142) Retrieve Directory File List in Timestamp Order
Date Thu, 07 Feb 2008 02:15:08 GMT


Niall Pemberton updated IO-142:

    Attachment: IO-142-listfiles-v1.patch

Atttaching a patch which includes 4 new methods in FileUtils:
 -  public static Iterable<File> listFiles(File, FileFilter, Comparator<File>)
 -  public static Iterable<File> listFiles(String, FileFilter, Comparator<File>)
 -  public static Iterable<File> listFilesRecursive(File, FileFilter, Comparator<File>)
 -  public static Iterable<File> listFilesRecursive(String, FileFilter, Comparator<File>)

These provide the option to filter an sort the files from either a single directory or recursviely
thru the directory structure.

Using these with IO's packages of Filters and Comparators implementations, would be pretty

Needs test cases

> Retrieve Directory File List in Timestamp Order
> -----------------------------------------------
>                 Key: IO-142
>                 URL:
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>         Environment: Java SE 5 - Windows, Linux
>            Reporter: Al Scherer
>         Attachments: IO-142-listfiles-v1.patch
> I searched your current Commons-IO 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 method would return a List<File> of the
files that match the filter in last-modified timestamp order.
> Sun explicitly does not provide this functionality - 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 and would be glad
to share the code with the commons project if you feel it would be useful. 
> The signature is:
> - public List<File> getFileListInTimestampOrder(FilenameFilter filter, String dirName)
> I've already written, tested and used code to do this.
> There are additional flavors that might be worthwhile, too.
> - public List<File> getFileListInTimestampOrderReversed(FilenameFilter filter,
String dirName)
> - public List<File> getFileListInNameOrder(FilenameFilter filter, String dirName)
> - public List<File> getFileListInNameOrderReversed(FilenameFilter filter, String
> BTW, I originally posted this on commons-lang but was given feedback that it might be
a better fit here.

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

View raw message