FileUtils.listFiles does not list matching files if File
parameter is a symbolic link.
MODIFY
src/changes/changes.xml
src/changes/changes.xml
@@ -47,12 +47,15 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="2.11.0" date="2021-MM-DD" description="Java 8 required.">
<!-- FIX -->
- <action dev="ggregory" type="fix" due-to="Arturo Bernal">
- Minor changes #243.
+ <action issue="IO-741" dev="ggregory" type="fix" due-to="Zach Sherman">
+ FileUtils.listFiles does not list matching files if File parameter is a symbolic link.
</action>
<action issue="IO-724" dev="ggregory" type="fix" due-to="liran2000">
FileUtils#deleteDirectory(File) exception Javadoc inaccurate update #245.
</action>
+ <action dev="ggregory" type="fix" due-to="Arturo Bernal">
+ Minor changes #243.
+ </action>
<!-- ADD -->
<action dev="ggregory" type="update" due-to="Gary Gregory">
Add SymbolicLinkFileFilter.

MODIFY
src/main/java/org/apache/commons/io/FileUtils.java
src/main/java/org/apache/commons/io/FileUtils.java
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
import java.nio.file.CopyOption;
+import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.NotDirectoryException;
@@ -2967,7 +2968,8 @@ private static BigInteger sizeOfDirectoryBig0(final File directory) {
throws IOException {
final IOFileFilter filter = extensions == null ? FileFileFilter.INSTANCE
: FileFileFilter.INSTANCE.and(new SuffixFileFilter(toSuffixes(extensions)));
- return PathUtils.walk(directory.toPath(), filter, toMaxDepth(recursive), false).map(Path::toFile);
+ return PathUtils.walk(directory.toPath(), filter, toMaxDepth(recursive), false, FileVisitOption.FOLLOW_LINKS)
+ .map(Path::toFile);
}
/**

[IO-741] FileUtils.listFiles does not list matching files if File
parameter is a symbolic link.