diff --git a/src/java/org/apache/commons/io/FileUtils.java b/src/java/org/apache/commons/io/FileUtils.java index f4d73b9b..bd523620 100644 --- a/src/java/org/apache/commons/io/FileUtils.java +++ b/src/java/org/apache/commons/io/FileUtils.java @@ -874,7 +874,7 @@ public static void copyDirectory(File srcDir, File destDir, // Cater for destination being directory within the source directory (see IO-141) List exclusionList = null; - if (destDir.getCanonicalPath().startsWith(srcDir.getCanonicalPath())) { + if (destDir.getCanonicalFile().toPath().startsWith(srcDir.getCanonicalFile().toPath())) { File[] srcFiles = filter == null ? srcDir.listFiles() : srcDir.listFiles(filter); if (srcFiles != null && srcFiles.length > 0) { exclusionList = new ArrayList(srcFiles.length);