[ https://issues.apache.org/jira/browse/IO-173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13215308#comment-13215308 ]
Marcos VinÃcius da Silva edited comment on IO-173 at 2/24/12 2:02 AM: ---------------------------------------------------------------------- I'm working on a path for this issue. Should I include a new method which lists the directories too, or keep as is, and just change the java docs to point the change? Something like that: {code} public static Collection<File> listFilesAndDirs( File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) { ... } {code} with the proper java docs. Actually the patch is with the second option. was (Author: detinho): I'm working on a path for this issue. Should I include a new method which lists the directories too, or keep as is, and just change the java docs to point the change? Something like that: {code} public static Collection<File> listFilesAndDirs( File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) { ... } {code} with the proper java docs. Actually the patch is with the first option. > FileUtils.listFiles() doesn't return directories > ------------------------------------------------ > > Key: IO-173 > URL: https://issues.apache.org/jira/browse/IO-173 > Project: Commons IO > Issue Type: Improvement > Components: Utilities > Affects Versions: 1.4 > Reporter: François Loison > Attachments: IO-173.patch > > > FileUtils.listFiles() returns only files and not directories. > So it can't be used to retrieve sub-directories. > Some fix could be applied: > {code} > private static void innerListFiles(Collection files, File directory, > IOFileFilter filter) { > File[] found = directory.listFiles((FileFilter) filter); > if (found != null) { > for (int i = 0; i < found.length; i++) { > if (found[i].isDirectory()) { > >>> fix > if ( addDirectories ) { > files.add(found[i]); > } > >>> end fix > innerListFiles(files, found[i], filter); > } else { > files.add(found[i]); > } > } > } > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira