DirectoryHelper { public static void copy(final Path from, final Path to) throws IOException { copy(from, to, null); } private  DirectoryHelper(); static void mkdir(final Path dir); static void mkdir(final File dir); static File mkdir(final File parent, final String child); static void clean(final Path dir); static boolean cleanIfExists(final Path dir); static void empty(final Path dir); static boolean emptyIfExists(final Path dir); static void delete(final Path dir); static void delete(final Path dir, @Nullable final Predicate<Path> excludeFilter); static boolean deleteIfExists(final Path dir); static boolean deleteIfExists(final Path dir, @Nullable final Predicate<Path> excludeFilter); static void copy(final Path from, final Path to); static void copy(final Path from, final Path to, @Nullable final Predicate<Path> excludeFilter); static boolean copyIfExists(final Path from, final Path to); static boolean copyIfExists(final Path from, final Path to, @Nullable final Predicate<Path> excludeFilter); static void move(final Path from, final Path to); static boolean moveIfExists(final Path from, final Path to); static void copyDeleteMove(final Path from, final Path to, @Nullable final Predicate<Path> excludeFilter); static boolean copyDeleteMoveIfExists(final Path from,
                                               final Path to,
                                               @Nullable final Predicate<Path> excludeFilter); static void apply(final Path from, final Function<Path, FileVisitResult> func); static void applyToFiles(final Path from, final Function<Path, FileVisitResult> func); static final Set<FileVisitOption> DEFAULT_FILE_VISIT_OPTIONS; }
@Test public void copy() throws IOException { final Path target = util.createTempDir().toPath(); DirectoryHelper.copy(root.toPath(), target); assertThat(target.toFile(), exists()); assertThat(target.toFile(), isDirectory()); assertThat(target.toFile(), not(isEmptyDirectory())); assertThat(target.resolve("dir2").resolve("dir21").toFile(), isDirectory()); assertThat(target.resolve("dir2").resolve("dir21").resolve("file211.txt").toFile(), isFile()); }