@Test public void preVisitDirectoryIgnoreHiddenHiddenFolder() throws IOException { CopyFileVisitor visitor = new CopyFileVisitor(fromFolder, targetFolder, true, true); FileVisitResult fileVisitResult = visitor.preVisitDirectory(hiddenFolder.toPath(), basicFileAttributesMock); assertThat(fileVisitResult, is(SKIP_SUBTREE)); }
@Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (exclusionMatcher.matches(dir) || exclusions.contains(dir) || (ignoreHiddenFolders && dir.toFile().isHidden())) { return FileVisitResult.SKIP_SUBTREE; } Path targetPath = targetFolder.toPath().resolve(fromFolder.toPath().relativize(dir)); if (!Files.exists(targetPath)) { Files.createDirectory(targetPath); } return FileVisitResult.CONTINUE; }
CopyFileVisitor implements FileVisitor<Path> { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (exclusionMatcher.matches(dir) || exclusions.contains(dir) || (ignoreHiddenFolders && dir.toFile().isHidden())) { return FileVisitResult.SKIP_SUBTREE; } Path targetPath = targetFolder.toPath().resolve(fromFolder.toPath().relativize(dir)); if (!Files.exists(targetPath)) { Files.createDirectory(targetPath); } return FileVisitResult.CONTINUE; } }
CopyFileVisitor implements FileVisitor<Path> { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (exclusionMatcher.matches(dir) || exclusions.contains(dir) || (ignoreHiddenFolders && dir.toFile().isHidden())) { return FileVisitResult.SKIP_SUBTREE; } Path targetPath = targetFolder.toPath().resolve(fromFolder.toPath().relativize(dir)); if (!Files.exists(targetPath)) { Files.createDirectory(targetPath); } return FileVisitResult.CONTINUE; } CopyFileVisitor(File fromFolder, File targetFolder);  CopyFileVisitor(File fromFolder, File targetFolder, Boolean ignoreHiddenFiles, Boolean ignoreHiddenFolders);  CopyFileVisitor(File fromFolder, File targetFolder, Boolean ignoreHiddenFiles, Boolean ignoreHiddenFolders,
                         PathMatcher exclusionMatcher); }
CopyFileVisitor implements FileVisitor<Path> { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (exclusionMatcher.matches(dir) || exclusions.contains(dir) || (ignoreHiddenFolders && dir.toFile().isHidden())) { return FileVisitResult.SKIP_SUBTREE; } Path targetPath = targetFolder.toPath().resolve(fromFolder.toPath().relativize(dir)); if (!Files.exists(targetPath)) { Files.createDirectory(targetPath); } return FileVisitResult.CONTINUE; } CopyFileVisitor(File fromFolder, File targetFolder);  CopyFileVisitor(File fromFolder, File targetFolder, Boolean ignoreHiddenFiles, Boolean ignoreHiddenFolders);  CopyFileVisitor(File fromFolder, File targetFolder, Boolean ignoreHiddenFiles, Boolean ignoreHiddenFolders,
                         PathMatcher exclusionMatcher); void setExclusions(List<Path> exclusions); @Override FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs); @Override FileVisitResult visitFile(Path file, BasicFileAttributes attrs); @Override FileVisitResult visitFileFailed(Path file, IOException exc); @Override FileVisitResult postVisitDirectory(Path dir, IOException exc); }
CopyFileVisitor implements FileVisitor<Path> { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (exclusionMatcher.matches(dir) || exclusions.contains(dir) || (ignoreHiddenFolders && dir.toFile().isHidden())) { return FileVisitResult.SKIP_SUBTREE; } Path targetPath = targetFolder.toPath().resolve(fromFolder.toPath().relativize(dir)); if (!Files.exists(targetPath)) { Files.createDirectory(targetPath); } return FileVisitResult.CONTINUE; } CopyFileVisitor(File fromFolder, File targetFolder);  CopyFileVisitor(File fromFolder, File targetFolder, Boolean ignoreHiddenFiles, Boolean ignoreHiddenFolders);  CopyFileVisitor(File fromFolder, File targetFolder, Boolean ignoreHiddenFiles, Boolean ignoreHiddenFolders,
                         PathMatcher exclusionMatcher); void setExclusions(List<Path> exclusions); @Override FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs); @Override FileVisitResult visitFile(Path file, BasicFileAttributes attrs); @Override FileVisitResult visitFileFailed(Path file, IOException exc); @Override FileVisitResult postVisitDirectory(Path dir, IOException exc);  }