@Test public void copyDeleteMoveToSubdir() throws IOException { final Path target = root.toPath().resolve("dir2/dir21"); DirectoryHelper.copyDeleteMove(root.toPath(), target, new Predicate<Path>() { @Override public boolean apply(@Nullable final Path input) { return input.startsWith(target); } }); assertThat(root, exists()); assertThat(root.toPath().resolve("dir1").toFile(), not(exists())); assertThat(root.toPath().resolve("dir2").toFile(), exists()); assertThat(root.toPath().resolve("dir2/file21.txt").toFile(), not(exists())); assertThat(root.toPath().resolve("dir2/file22.txt").toFile(), not(exists())); assertThat(root.toPath().resolve("dir2/file23.txt").toFile(), not(exists())); assertThat(root.toPath().resolve("dir2/dir21").toFile(), exists()); assertThat(root.toPath().resolve("dir2/dir21/file211.txt").toFile(), exists()); assertThat(root.toPath().resolve("dir2/dir21/file212.txt").toFile(), exists()); assertThat(root.toPath().resolve("dir2/dir21/dir1").toFile(), exists()); assertThat(root.toPath().resolve("dir2/dir21/dir1/file11.txt").toFile(), exists()); assertThat(root.toPath().resolve("dir2/dir21/dir1/file12.txt").toFile(), exists()); assertThat(root.toPath().resolve("dir2/dir21/dir2").toFile(), exists()); assertThat(root.toPath().resolve("dir2/dir21/dir2/file21.txt").toFile(), exists()); assertThat(root.toPath().resolve("dir2/dir21/dir2/file22.txt").toFile(), exists()); assertThat(root.toPath().resolve("dir2/dir21/dir2/file23.txt").toFile(), exists()); assertThat(root, exists()); assertThat(target.toFile(), exists()); assertThat(target.toFile(), isDirectory()); assertThat(target.toFile(), not(isEmptyDirectory())); assertThat(root.toPath().resolve("dir2").resolve("dir21").toFile(), isDirectory()); assertThat(root.toPath().resolve("dir2").resolve("dir21").resolve("file211.txt").toFile(), isFile()); }
public static void copyDeleteMove(final Path from, final Path to, @Nullable final Predicate<Path> excludeFilter) throws IOException { copy(from, to, excludeFilter); delete(from, excludeFilter); }
DirectoryHelper { public static void copyDeleteMove(final Path from, final Path to, @Nullable final Predicate<Path> excludeFilter) throws IOException { copy(from, to, excludeFilter); delete(from, excludeFilter); } }
DirectoryHelper { public static void copyDeleteMove(final Path from, final Path to, @Nullable final Predicate<Path> excludeFilter) throws IOException { copy(from, to, excludeFilter); delete(from, excludeFilter); } private  DirectoryHelper(); }
DirectoryHelper { public static void copyDeleteMove(final Path from, final Path to, @Nullable final Predicate<Path> excludeFilter) throws IOException { copy(from, to, excludeFilter); delete(from, excludeFilter); } 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); }
DirectoryHelper { public static void copyDeleteMove(final Path from, final Path to, @Nullable final Predicate<Path> excludeFilter) throws IOException { copy(from, to, excludeFilter); delete(from, excludeFilter); } 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; }