@Test public void deleteDir() throws IOException{ Path dir = Files.createTempDirectory("DIR"); Path file = createTempFile(dir, "FILE", ".tmp"); assertThat(exists(dir), is(true)); assertThat(exists(file), is(true)); FileUtils.delete(dir); assertThat(exists(dir), is(false)); assertThat(exists(file), is(false)); }
public static void deleteDir(Path dir, DeleteVisitor visitor) { try{ if(Files.exists(dir) && Files.isDirectory(dir)) { Files.walkFileTree(dir, visitor); } } catch (IOException e) { throw new RuntimeException(e); } }
FileUtils { public static void deleteDir(Path dir, DeleteVisitor visitor) { try{ if(Files.exists(dir) && Files.isDirectory(dir)) { Files.walkFileTree(dir, visitor); } } catch (IOException e) { throw new RuntimeException(e); } } }
FileUtils { public static void deleteDir(Path dir, DeleteVisitor visitor) { try{ if(Files.exists(dir) && Files.isDirectory(dir)) { Files.walkFileTree(dir, visitor); } } catch (IOException e) { throw new RuntimeException(e); } } private  FileUtils(); }
FileUtils { public static void deleteDir(Path dir, DeleteVisitor visitor) { try{ if(Files.exists(dir) && Files.isDirectory(dir)) { Files.walkFileTree(dir, visitor); } } catch (IOException e) { throw new RuntimeException(e); } } private  FileUtils(); static void delete(Path path); static void delete(Path path, String glob); static void deleteDir(Path dir, DeleteVisitor visitor); static void copy(Path source, Path target); static void copy(Path source, Path target, String glob); static void copy(CopyVisitor visitor); static void copyFile(Path source, Path target); static Path createFile(Path dir, String name); static Path createDirectories(Path dir); static String read(Path file); static String read(Path file, Charset charset); static List<Path> ls(Path dir); static void move(Path from, Path to); static void createSymbolicLink(Path link, Path targetFile); }
FileUtils { public static void deleteDir(Path dir, DeleteVisitor visitor) { try{ if(Files.exists(dir) && Files.isDirectory(dir)) { Files.walkFileTree(dir, visitor); } } catch (IOException e) { throw new RuntimeException(e); } } private  FileUtils(); static void delete(Path path); static void delete(Path path, String glob); static void deleteDir(Path dir, DeleteVisitor visitor); static void copy(Path source, Path target); static void copy(Path source, Path target, String glob); static void copy(CopyVisitor visitor); static void copyFile(Path source, Path target); static Path createFile(Path dir, String name); static Path createDirectories(Path dir); static String read(Path file); static String read(Path file, Charset charset); static List<Path> ls(Path dir); static void move(Path from, Path to); static void createSymbolicLink(Path link, Path targetFile);  }