[ https://issues.apache.org/jira/browse/IO-495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory closed IO-495. ------------------------------ Resolution: Abandoned Closing: No PR, no further discussion in the ticket. > FileUtils.listFilesAndDirs behaves unexpected > --------------------------------------------- > > Key: IO-495 > URL: https://issues.apache.org/jira/browse/IO-495 > Project: Commons IO > Issue Type: Improvement > Components: Utilities > Affects Versions: 2.4 > Environment: Ubuntu, Java 8 > Reporter: David Georg Reichelt > Priority: Minor > Labels: patch > Attachments: diff.txt > > > The behaviour of listFilesAndDirs is quite unexpected in my opinion. > FileUtils.listFiles searches for files in a directory, where the files match > the filter, including the subdirectories which are matched by the dirFilter. > FileUtils.listFilesAndDirs searches for files and directories, where the > files match the filter and the directories match the directory filter, > including the subdirectories which are matched by the dirFilter. > But, if one extends the listFiles-method, the logical behaviour would be: > FileUtils.listFiles searches for files and directories in a directory, where > the files and directories match the filter, including the subdirectories > which are matched by the dirFilter. > This method has been discussed in > https://issues.apache.org/jira/browse/IO-328, but there the point was, that > listFilesAndDirs also includes the root folder, which was documented > correctly after this bug. In my opinion, the problem not the inclusion of the > root filter but the different behaviour from the listFiles-method. > I'll provide an patch, where the method filters everything with the first > filter and includes subdirectories if they are included by the dirFilter. One > could also keep the current method, but imho it then should be named > different as it behaves different than listFiles (maybe filterFilesAndDirs?). -- This message was sent by Atlassian Jira (v8.20.7#820007)